diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-21 12:12:45 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-21 12:12:45 +0100 |
commit | b82de0f0087a91165a7306fa9fe11a0cbc48fcd5 (patch) | |
tree | ec9aba0ff75b628dc0cb9303525e63cd4471305a /lib | |
parent | 585e6a992fcd1baa712ae436bbacd76672f614c8 (diff) | |
download | gitlab-ce-b82de0f0087a91165a7306fa9fe11a0cbc48fcd5.tar.gz |
Reduce stage seeds coupling between pipeline and YAML
This is a first step to decouple pipeline from YAML processing. It
reduces the coupling by removing some methods that introduce coupling
and by moving logic into separate chain element that is being used to
populate pipelines with stages and builds.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/populate.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/validate/config.rb | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/populate.rb b/lib/gitlab/ci/pipeline/chain/populate.rb index 94d9b44b257..989cb8312ba 100644 --- a/lib/gitlab/ci/pipeline/chain/populate.rb +++ b/lib/gitlab/ci/pipeline/chain/populate.rb @@ -21,15 +21,19 @@ module Gitlab pipeline.stages << seed.to_resource end + if pipeline.stages.none? + return error('No stages / jobs for this pipeline.') + end + if pipeline.invalid? - error('Failed to build the pipeline!') + return error('Failed to build the pipeline!') end raise Populate::PopulateError if pipeline.persisted? end def break? - pipeline.invalid? + pipeline.errors.any? end end end diff --git a/lib/gitlab/ci/pipeline/chain/validate/config.rb b/lib/gitlab/ci/pipeline/chain/validate/config.rb index 075504bcce5..655a6d0b3e7 100644 --- a/lib/gitlab/ci/pipeline/chain/validate/config.rb +++ b/lib/gitlab/ci/pipeline/chain/validate/config.rb @@ -18,10 +18,6 @@ module Gitlab return error(@pipeline.yaml_errors) end - - unless @pipeline.has_stage_seeds? - return error('No stages / jobs for this pipeline.') - end end def break? |