Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting strategy and max in flight for stopped app deployments #3910

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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