Commit e51bc13f authored by Grzegorz Bizon's avatar Grzegorz Bizon

Set a pipeline failure reason when it has YAML errors

parent 80a68d68
...@@ -72,7 +72,8 @@ module Ci ...@@ -72,7 +72,8 @@ module Ci
} }
enum failure_reason: { enum failure_reason: {
unknown_failure: 0 unknown_failure: 0,
config_error: 1
}.merge(EE_FAILURE_REASONS) }.merge(EE_FAILURE_REASONS)
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