Commit 72818f2c authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix creation of deployment on build that is retried, redeployed or rollback

parent 2550c1c2
...@@ -60,6 +60,7 @@ v 8.10.0 (unreleased) ...@@ -60,6 +60,7 @@ v 8.10.0 (unreleased)
- Allow expanding and collapsing files in diff view (!4990) - Allow expanding and collapsing files in diff view (!4990)
- Collapse large diffs by default (!4990) - Collapse large diffs by default (!4990)
- Fix mentioned users list on diff notes - Fix mentioned users list on diff notes
- Fix creation of deployment on build that is retried, redeployed or rollback
- Check for conflicts with existing Project's wiki path when creating a new project. - Check for conflicts with existing Project's wiki path when creating a new project.
- Show last push widget in upstream after push to fork - Show last push widget in upstream after push to fork
- Cache todos pending/done dashboard query counts. - Cache todos pending/done dashboard query counts.
......
...@@ -53,6 +53,7 @@ module Ci ...@@ -53,6 +53,7 @@ module Ci
new_build.stage_idx = build.stage_idx new_build.stage_idx = build.stage_idx
new_build.trigger_request = build.trigger_request new_build.trigger_request = build.trigger_request
new_build.user = user new_build.user = user
new_build.environment = build.environment
new_build.save new_build.save
MergeRequests::AddTodoWhenBuildFailsService.new(build.project, nil).close(new_build) MergeRequests::AddTodoWhenBuildFailsService.new(build.project, nil).close(new_build)
new_build new_build
......
...@@ -89,6 +89,12 @@ describe CreateDeploymentService, services: true do ...@@ -89,6 +89,12 @@ describe CreateDeploymentService, services: true do
expect_any_instance_of(described_class).to receive(:execute) expect_any_instance_of(described_class).to receive(:execute)
subject subject
end end
it 'is set as deployable' do
subject
expect(Deployment.last.deployable).to eq(deployable)
end
end end
context 'without environment specified' do context 'without environment specified' do
...@@ -105,6 +111,8 @@ describe CreateDeploymentService, services: true do ...@@ -105,6 +111,8 @@ describe CreateDeploymentService, services: true do
context 'when build succeeds' do context 'when build succeeds' do
it_behaves_like 'does create environment and deployment' do it_behaves_like 'does create environment and deployment' do
let(:deployable) { build }
subject { build.success } subject { build.success }
end end
end end
...@@ -114,6 +122,14 @@ describe CreateDeploymentService, services: true do ...@@ -114,6 +122,14 @@ describe CreateDeploymentService, services: true do
subject { build.drop } subject { build.drop }
end end
end end
context 'when build is retried' do
it_behaves_like 'does create environment and deployment' do
let(:deployable) { Ci::Build.retry(build) }
subject { deployable.success }
end
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment