diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-21 13:43:27 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-21 13:43:27 +0300 |
commit | 585e6a992fcd1baa712ae436bbacd76672f614c8 (patch) | |
tree | 1477af145df6ee8f53d3b0f2e3967e48320c8cab /lib/gitlab/ci/pipeline/chain | |
parent | e79ebabb72f66b24f0523584b5ad2a61c88c330d (diff) |
Add specs for chain element that populates a pipeline
Diffstat (limited to 'lib/gitlab/ci/pipeline/chain')
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/populate.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/populate.rb b/lib/gitlab/ci/pipeline/chain/populate.rb index 5368ff15481..94d9b44b257 100644 --- a/lib/gitlab/ci/pipeline/chain/populate.rb +++ b/lib/gitlab/ci/pipeline/chain/populate.rb @@ -3,6 +3,8 @@ module Gitlab module Pipeline module Chain class Populate < Chain::Base + include Chain::Helpers + PopulateError = Class.new(StandardError) def perform! @@ -19,11 +21,15 @@ module Gitlab pipeline.stages << seed.to_resource end + if pipeline.invalid? + error('Failed to build the pipeline!') + end + raise Populate::PopulateError if pipeline.persisted? end def break? - pipeline.persisted? + pipeline.invalid? end end end |