Commit 9f639b07 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Set a pipeline failure reason when it has YAML errors

Conflicts:
	app/models/ci/pipeline.rb
parent 41d8030e
...@@ -59,7 +59,8 @@ module Ci ...@@ -59,7 +59,8 @@ module Ci
} }
enum failure_reason: { enum failure_reason: {
unknown_failure: 0 unknown_failure: 0,
config_error: 1
} }
state_machine :status, initial: :created do state_machine :status, initial: :created do
......
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
end end
if @command.save_incompleted && @pipeline.has_yaml_errors? if @command.save_incompleted && @pipeline.has_yaml_errors?
@pipeline.drop @pipeline.drop!(:config_error)
end end
return error(@pipeline.yaml_errors) return error(@pipeline.yaml_errors)
......
...@@ -55,6 +55,10 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Config do ...@@ -55,6 +55,10 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Config do
it 'fails the pipeline' do it 'fails the pipeline' do
expect(pipeline.reload).to be_failed expect(pipeline.reload).to be_failed
end end
it 'sets a config error failure reason' do
expect(pipeline.reload.config_error?).to eq true
end
end end
context 'when saving incomplete pipeline is not allowed' do context 'when saving incomplete pipeline is not allowed' do
......
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