Commit 17a0a6cc authored by Grzegorz Bizon's avatar Grzegorz Bizon

Set pipeline failure reason when limits are exceeded

parent 53fa7948
...@@ -18,12 +18,10 @@ module EE ...@@ -18,12 +18,10 @@ module EE
def perform! def perform!
return unless @limit.exceeded? return unless @limit.exceeded?
# TODO, add failure reason
# TODO, transaction?
@pipeline.cancel_running @pipeline.cancel_running
retry_optimistic_lock(@pipeline) do retry_optimistic_lock(@pipeline) do
@pipeline.failure_reason = :activity_limit_exceeded
@pipeline.drop! @pipeline.drop!
end end
......
...@@ -18,7 +18,7 @@ module EE ...@@ -18,7 +18,7 @@ module EE
return unless @limit.exceeded? return unless @limit.exceeded?
if @command.save_incompleted if @command.save_incompleted
# TODO, add failure reason @pipeline.failure_reason = :size_limit_exceeded
@pipeline.drop @pipeline.drop
end end
......
...@@ -47,6 +47,10 @@ describe EE::Gitlab::Ci::Pipeline::Chain::Limit::Activity do ...@@ -47,6 +47,10 @@ describe EE::Gitlab::Ci::Pipeline::Chain::Limit::Activity do
expect(step.break?).to be true expect(step.break?).to be true
end end
it 'sets a valid failure reason' do
expect(pipeline.activity_limit_exceeded?).to be true
end
it 'appends validation error' do it 'appends validation error' do
expect(pipeline.errors.to_a) expect(pipeline.errors.to_a)
.to include 'Active pipelines limit exceeded by 2 pipelines!' .to include 'Active pipelines limit exceeded by 2 pipelines!'
......
...@@ -50,6 +50,10 @@ describe EE::Gitlab::Ci::Pipeline::Chain::Limit::Size do ...@@ -50,6 +50,10 @@ describe EE::Gitlab::Ci::Pipeline::Chain::Limit::Size do
expect(step.break?).to be true expect(step.break?).to be true
end end
it 'sets a valid failure reason' do
expect(pipeline.size_limit_exceeded?).to be true
end
it 'appends validation error' do it 'appends validation error' do
expect(pipeline.errors.to_a) expect(pipeline.errors.to_a)
.to include 'Pipeline size limit exceeded by 1 job!' .to include 'Pipeline size limit exceeded by 1 job!'
......
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