Set a pipeline failure reason when it has YAML errors

Conflicts:
	app/models/ci/pipeline.rb
This commit is contained in:
Grzegorz Bizon 2017-10-02 13:40:12 +02:00
parent 41d8030ec2
commit 9f639b0733
3 changed files with 7 additions and 2 deletions

View file

@ -59,7 +59,8 @@ module Ci
}
enum failure_reason: {
unknown_failure: 0
unknown_failure: 0,
config_error: 1
}
state_machine :status, initial: :created do

View file

@ -13,7 +13,7 @@ module Gitlab
end
if @command.save_incompleted && @pipeline.has_yaml_errors?
@pipeline.drop
@pipeline.drop!(:config_error)
end
return error(@pipeline.yaml_errors)

View file

@ -55,6 +55,10 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Config do
it 'fails the pipeline' do
expect(pipeline.reload).to be_failed
end
it 'sets a config error failure reason' do
expect(pipeline.reload.config_error?).to eq true
end
end
context 'when saving incomplete pipeline is not allowed' do