Skip to content

Commit

Permalink
Fix setting strategy and max in flight for stopped app deployments (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Samze authored Jul 31, 2024
1 parent 6b76837 commit 61ca706
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/actions/deployment_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ def deployment_for_stopped_app(app, message, previous_deployment, previous_dropl
original_web_process_instance_count: desired_instances(app.oldest_web_process, previous_deployment),
revision_guid: revision&.guid,
revision_version: revision&.version,
strategy: DeploymentModel::ROLLING_STRATEGY,
max_in_flight: message.options ? message.options[:max_in_flight] : 1
strategy: message.strategy,
max_in_flight: message.max_in_flight
)

MetadataUpdate.update(deployment, message)
Expand Down
7 changes: 6 additions & 1 deletion spec/unit/actions/deployment_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ module VCAP::CloudController
end

context 'when the app is stopped' do
let(:max_in_flight) { 3 }
let(:strategy) { 'canary' }

before do
app.update(desired_state: ProcessModel::STOPPED)
app.save
Expand Down Expand Up @@ -525,6 +528,8 @@ module VCAP::CloudController
expect(deployment.previous_droplet).to eq(original_droplet)
expect(deployment.original_web_process_instance_count).to eq(3)
expect(deployment.last_healthy_at).to eq(deployment.created_at)
expect(deployment.strategy).to eq('canary')
expect(deployment.max_in_flight).to eq(3)
end

it 'records an audit event for the deployment' do
Expand All @@ -548,7 +553,7 @@ module VCAP::CloudController
'type' => nil,
'revision_guid' => app.latest_revision.guid,
'request' => message.audit_hash,
'strategy' => 'rolling'
'strategy' => 'canary'
})
end

Expand Down

0 comments on commit 61ca706

Please sign in to comment.