diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-21 13:10:13 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-21 13:10:13 +0300 |
commit | cd6a2afbbb508e96f67c1f192cee2c1d379b1749 (patch) | |
tree | 24da16b445fa2cdcb3dbc8dc59138aead20e4c4e /lib/ci | |
parent | 8b550db33e27d95424de31acf20835cc731684a5 (diff) |
Move CI image configuration entry to new CI config
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index c52d4d63382..f4ef449c84c 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -14,7 +14,7 @@ module Ci ALLOWED_CACHE_KEYS = [:key, :untracked, :paths] ALLOWED_ARTIFACTS_KEYS = [:name, :untracked, :paths, :when, :expire_in] - attr_reader :after_script, :image, :services, :path, :cache + attr_reader :after_script, :services, :path, :cache def initialize(config, path = nil) @ci_config = Gitlab::Ci::Config.new(config) @@ -22,8 +22,11 @@ module Ci @path = path - initial_parsing + unless @ci_config.valid? + raise ValidationError, @ci_config.errors.first + end + initial_parsing validate! rescue Gitlab::Ci::Config::Loader::FormatError => e raise ValidationError, e.message @@ -60,6 +63,9 @@ module Ci private def initial_parsing + @before_script = @ci_config.before_script + @image = @ci_config.image + @after_script = @config[:after_script] @image = @config[:image] @services = @config[:services] @@ -87,7 +93,7 @@ module Ci { stage_idx: stages.index(job[:stage]), stage: job[:stage], - commands: [job[:before_script] || [@ci_config.before_script], job[:script]].flatten.compact.join("\n"), + commands: [job[:before_script] || [@before_script], job[:script]].flatten.compact.join("\n"), tag_list: job[:tags] || [], name: name, only: job[:only], @@ -107,10 +113,6 @@ module Ci end def validate! - unless @ci_config.valid? - raise ValidationError, @ci_config.errors.first - end - validate_global! @jobs.each do |name, job| @@ -125,10 +127,6 @@ module Ci raise ValidationError, "after_script should be an array of strings" end - unless @image.nil? || @image.is_a?(String) - raise ValidationError, "image should be a string" - end - unless @services.nil? || validate_array_of_strings(@services) raise ValidationError, "services should be an array of strings" end |