Skip to content
Snippets Groups Projects

Add auto-cancel for pending pipelines on branch, if they are not HEAD

1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
@@ -26,7+26,7 @@
it { expect(pipeline).to have_attributes(status: 'pending') }
it { expect(pipeline.builds.first).to be_kind_of(Ci::Build) }
end
context 'valid params' do
let(:pipeline) { execute_service }
@@ -39,7+39,7 @@
)
end
def previous_commit_sha_from_ref(ref)
project.commit(ref).parent.sha
end
before do
project.update(auto_cancel_pending_pipelines: 'enabled')
end
def previous_commit_sha_from_ref(ref)
project.commit(ref).parent.sha
end
it 'does not cancel HEAD pipeline' do
pipeline
previous_pipeline = pipeline_on_previous_commit
pipeline_on_previous_commit
expect(pipeline.reload)
.to have_attributes(status: 'pending', auto_canceled_by_id: nil)
@@ -133,7+133,7 @@
before do
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { message }
end
it_behaves_like 'a failed pipeline'
end
end
Loading