summaryrefslogtreecommitdiff
path: root/lib/ci
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-21 13:02:14 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-21 13:02:14 +0200
commitd399128955756fe7a4651d6595ae31406055dfb8 (patch)
tree584ffe3cddebfa7471341127bd2e1fb01c41f55a /lib/ci
parentfc00c545b27ab2f4bf713ae246c197f809dd4c11 (diff)
downloadgitlab-ce-d399128955756fe7a4651d6595ae31406055dfb8.tar.gz
Handle after script CI config in new classes
This also makes Script to return an array of commands instead of concatented command, which is our current direction.
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 2cb46448e76..c0f2a258836 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, :path, :cache
+ attr_reader :path, :cache
def initialize(config, path = nil)
@ci_config = Gitlab::Ci::Config.new(config)
@@ -65,10 +65,9 @@ module Ci
def initial_parsing
@before_script = @ci_config.before_script
@image = @ci_config.image
-
- @after_script = @config[:after_script]
- @image = @config[:image]
+ @after_script = @ci_config.after_script
@services = @ci_config.services
+
@stages = @config[:stages] || @config[:types]
@variables = @config[:variables] || {}
@cache = @config[:cache]
@@ -93,7 +92,7 @@ module Ci
{
stage_idx: stages.index(job[:stage]),
stage: job[:stage],
- commands: [job[:before_script] || [@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],
@@ -123,10 +122,6 @@ module Ci
end
def validate_global!
- unless @after_script.nil? || validate_array_of_strings(@after_script)
- raise ValidationError, "after_script should be an array of strings"
- end
-
unless @stages.nil? || validate_array_of_strings(@stages)
raise ValidationError, "stages should be an array of strings"
end