diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2017-03-24 09:03:11 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-03-24 23:04:51 +0800 |
commit | a3ba0466ae984e6bc88e887e50cd1c76e6c16cb7 (patch) | |
tree | 1ae5321431858b8b69cb7f697d6f650dc1135862 | |
parent | 671e345f7c33cddd58564e76f11c7fd149b93ac1 (diff) | |
download | gitlab-ce-a3ba0466ae984e6bc88e887e50cd1c76e6c16cb7.tar.gz |
Merge branch 'fix-ci-api-regression-for-after-script' into 'master'
Fix after_script processing for Runners APIv4
See merge request !10185
-rw-r--r-- | changelogs/unreleased/fix-ci-api-regression-for-after-script.yml | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/build/step.rb | 9 | ||||
-rw-r--r-- | spec/factories/ci/builds.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/build/step_spec.rb | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/changelogs/unreleased/fix-ci-api-regression-for-after-script.yml b/changelogs/unreleased/fix-ci-api-regression-for-after-script.yml new file mode 100644 index 00000000000..cdd7d1e6945 --- /dev/null +++ b/changelogs/unreleased/fix-ci-api-regression-for-after-script.yml @@ -0,0 +1,4 @@ +--- +title: Fix after_script processing for Runners APIv4 +merge_request: 10185 +author: diff --git a/lib/gitlab/ci/build/step.rb b/lib/gitlab/ci/build/step.rb index 1877429ac46..ee034d9cc56 100644 --- a/lib/gitlab/ci/build/step.rb +++ b/lib/gitlab/ci/build/step.rb @@ -7,13 +7,12 @@ module Gitlab WHEN_ALWAYS = 'always'.freeze attr_reader :name - attr_writer :script - attr_accessor :timeout, :when, :allow_failure + attr_accessor :script, :timeout, :when, :allow_failure class << self def from_commands(job) self.new(:script).tap do |step| - step.script = job.commands + step.script = job.commands.split("\n") step.timeout = job.timeout step.when = WHEN_ON_SUCCESS end @@ -36,10 +35,6 @@ module Gitlab @name = name @allow_failure = false end - - def script - @script.split("\n") - end end end end diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 6b0d084614b..f78086211f7 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -172,7 +172,7 @@ FactoryGirl.define do { image: 'ruby:2.1', services: ['postgres'], - after_script: "ls\ndate", + after_script: %w(ls date), artifacts: { name: 'artifacts_file', untracked: false, diff --git a/spec/lib/gitlab/ci/build/step_spec.rb b/spec/lib/gitlab/ci/build/step_spec.rb index 2a314a744ca..49457b129e3 100644 --- a/spec/lib/gitlab/ci/build/step_spec.rb +++ b/spec/lib/gitlab/ci/build/step_spec.rb @@ -25,7 +25,7 @@ describe Gitlab::Ci::Build::Step do end context 'when after_script is not empty' do - let(:job) { create(:ci_build, options: { after_script: "ls -la\ndate" }) } + let(:job) { create(:ci_build, options: { after_script: ['ls -la', 'date'] }) } it 'fabricates an object' do expect(subject.name).to eq(:after_script) |