Skip to content

Commit

Permalink
Do not finish deployment run when staged rollout is halted
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Oct 11, 2023
1 parent 165c0d9 commit 43776f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/models/staged_rollout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class StagedRollout < ApplicationRecord
end

event :halt, guard: -> { deployment_run.rolloutable? }, after_commit: -> { event_stamp!(reason: :halted, kind: :notice, data: stamp_data) } do
after { deployment_run.complete! }
transitions from: [:started, :paused, :failed], to: :stopped
end

Expand Down
8 changes: 4 additions & 4 deletions spec/models/staged_rollout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
expect(rollout.reload.stopped?).to be(true)
end

it "completes the deployment run if halt succeeds" do
it "does not complete the deployment run if halt succeeds" do
allow(providable_dbl).to receive(:halt_release).and_return(GitHub::Result.new)
rollout.halt_release!

expect(rollout.deployment_run.reload.released?).to be(true)
expect(rollout.deployment_run.reload.released?).to be(false)
end

it "does not complete the deployment run if halt fails" do
Expand Down Expand Up @@ -134,11 +134,11 @@
expect(rollout.reload.stopped?).to be(true)
end

it "marks deployment run is completed" do
it "does not mark deployment run is completed" do
allow(providable_dbl).to receive(:halt_phased_release).and_return(GitHub::Result.new)
rollout.halt_release!

expect(deployment_run.reload.released?).to be(true)
expect(deployment_run.reload.released?).to be(false)
end

it "does not complete the deployment run if rollout fails" do
Expand Down

0 comments on commit 43776f0

Please sign in to comment.