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