diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-13 16:04:12 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-13 16:04:12 +0300 |
commit | 036e297ca3c39f90aebc76d5acb2e01f32364d0d (patch) | |
tree | e1d6c96804c28e7fe6693759d8124ae080557865 /lib | |
parent | 6920390aad683dcc73109be5a23b647c918f9309 (diff) |
Expose CI job commands and use in legacy processor
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 13 | ||||
-rw-r--r-- | lib/gitlab/ci/config/node/job.rb | 15 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index ed8dd0f9e47..61075d3b923 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -80,12 +80,7 @@ module Ci { stage_idx: @stages.index(job[:stage]), stage: job[:stage], - ## - # Refactoring note: - # - before script behaves differently than after script - # - after script returns an array of commands - # - before script should be a concatenated command - commands: [job[:before_script] || @before_script, job[:script]].flatten.compact.join("\n"), + commands: job[:commands], tag_list: job[:tags] || [], name: name, only: job[:only], @@ -124,8 +119,12 @@ module Ci end def validate_job_keys!(name, job) + ## + # TODO, remove refactoring keys + # + refactoring_keys = [:commands] job.keys.each do |key| - unless ALLOWED_JOB_KEYS.include? key + unless (ALLOWED_JOB_KEYS + refactoring_keys).include? key raise ValidationError, "#{name} job: unknown parameter #{key}" end end diff --git a/lib/gitlab/ci/config/node/job.rb b/lib/gitlab/ci/config/node/job.rb index 5ee91ebcf0b..bb1c3386bd4 100644 --- a/lib/gitlab/ci/config/node/job.rb +++ b/lib/gitlab/ci/config/node/job.rb @@ -40,23 +40,24 @@ module Gitlab def before_script if before_script_defined? - before_script_value.to_a + before_script_value else - @global.before_script.to_a + @global.before_script end end def commands - (before_script + script).join("\n") + [before_script, script].compact.join("\n") end private def to_hash - { before_script: before_script_value, - script: script_value, - stage: stage_value, - after_script: after_script_value } + { before_script: before_script, + script: script, + commands: commands, + stage: stage, + after_script: after_script } end def compose! |