Commit 500b61e1 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Move after script CI job confg to new processor

parent 489e9be4
...@@ -24,7 +24,10 @@ module Gitlab ...@@ -24,7 +24,10 @@ module Gitlab
node :type, Stage, node :type, Stage,
description: 'Deprecated: stage this job will be executed into.' description: 'Deprecated: stage this job will be executed into.'
helpers :before_script, :script, :stage, :type node :after_script, Script,
description: 'Commands that will be executed when finishing job.'
helpers :before_script, :script, :stage, :type, :after_script
def value def value
raise InvalidError unless valid? raise InvalidError unless valid?
...@@ -41,7 +44,8 @@ module Gitlab ...@@ -41,7 +44,8 @@ module Gitlab
def to_hash def to_hash
{ before_script: before_script_value, { before_script: before_script_value,
script: script_value, script: script_value,
stage: stage_value } stage: stage_value,
after_script: after_script_value }
end end
def compose! def compose!
......
...@@ -984,7 +984,7 @@ EOT ...@@ -984,7 +984,7 @@ EOT
config = YAML.dump({ rspec: { script: "test", after_script: [10, "test"] } }) config = YAML.dump({ rspec: { script: "test", after_script: [10, "test"] } })
expect do expect do
GitlabCiYamlProcessor.new(config, path) GitlabCiYamlProcessor.new(config, path)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: after_script should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "jobs:rspec:after_script config should be an array of strings")
end end
it "returns errors if image parameter is invalid" do it "returns errors if image parameter is invalid" do
......
...@@ -48,14 +48,16 @@ describe Gitlab::Ci::Config::Node::Job do ...@@ -48,14 +48,16 @@ describe Gitlab::Ci::Config::Node::Job do
context 'when entry is correct' do context 'when entry is correct' do
let(:config) do let(:config) do
{ before_script: %w[ls pwd], { before_script: %w[ls pwd],
script: 'rspec' } script: 'rspec',
after_script: %w[cleanup] }
end end
it 'returns correct value' do it 'returns correct value' do
expect(entry.value) expect(entry.value)
.to eq(before_script: %w[ls pwd], .to eq(before_script: %w[ls pwd],
script: %w[rspec], script: %w[rspec],
stage: 'test') stage: 'test',
after_script: %w[cleanup])
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment