Skip to content
Snippets Groups Projects
Commit 0cc8e93a authored by Cédric Tabin's avatar Cédric Tabin
Browse files

Adds 'tags' keyword in 'default'

parent a6ad3119
No related branches found
No related tags found
No related merge requests found
Loading
@@ -135,6 +135,7 @@ The following job parameters can be defined inside a `default:` block:
Loading
@@ -135,6 +135,7 @@ The following job parameters can be defined inside a `default:` block:
- [`services`](#services) - [`services`](#services)
- [`before_script`](#before_script-and-after_script) - [`before_script`](#before_script-and-after_script)
- [`after_script`](#before_script-and-after_script) - [`after_script`](#before_script-and-after_script)
- [`tags`](#tags)
- [`cache`](#cache) - [`cache`](#cache)
- [`retry`](#retry) - [`retry`](#retry)
- [`timeout`](#timeout) - [`timeout`](#timeout)
Loading
Loading
Loading
@@ -13,7 +13,8 @@ describe EE::Gitlab::Ci::Config::Entry::Bridge do
Loading
@@ -13,7 +13,8 @@ describe EE::Gitlab::Ci::Config::Entry::Bridge do
# that we know that we don't want to inherit # that we know that we don't want to inherit
# as they do not have sense in context of Bridge # as they do not have sense in context of Bridge
let(:ignored_inheritable_columns) do let(:ignored_inheritable_columns) do
%i[before_script after_script image services cache interruptible timeout retry] %i[before_script after_script image services cache interruptible timeout
retry tags]
end end
end end
   
Loading
Loading
# frozen_string_literal: true
module Gitlab
module Ci
class Config
module Entry
##
# Entry that represents the interrutible value.
#
class Boolean < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Validatable
validations do
validates :config, boolean: true
end
end
end
end
end
end
Loading
@@ -15,7 +15,7 @@ module Gitlab
Loading
@@ -15,7 +15,7 @@ module Gitlab
   
ALLOWED_KEYS = %i[before_script image services ALLOWED_KEYS = %i[before_script image services
after_script cache interruptible after_script cache interruptible
timeout retry].freeze timeout retry tags].freeze
   
validations do validations do
validates :config, allowed_keys: ALLOWED_KEYS validates :config, allowed_keys: ALLOWED_KEYS
Loading
@@ -41,7 +41,7 @@ module Gitlab
Loading
@@ -41,7 +41,7 @@ module Gitlab
description: 'Configure caching between build jobs.', description: 'Configure caching between build jobs.',
inherit: true inherit: true
   
entry :interruptible, Entry::Boolean, entry :interruptible, ::Gitlab::Config::Entry::Boolean,
description: 'Set jobs interruptible default value.', description: 'Set jobs interruptible default value.',
inherit: false inherit: false
   
Loading
@@ -53,7 +53,12 @@ module Gitlab
Loading
@@ -53,7 +53,12 @@ module Gitlab
description: 'Set retry default value.', description: 'Set retry default value.',
inherit: false inherit: false
   
helpers :before_script, :image, :services, :after_script, :cache, :interruptible, :timeout, :retry entry :tags, ::Gitlab::Config::Entry::ArrayOfStrings,
description: 'Set the default tags.',
inherit: false
helpers :before_script, :image, :services, :after_script, :cache, :interruptible,
:timeout, :retry, :tags
   
private private
   
Loading
Loading
Loading
@@ -36,7 +36,6 @@ module Gitlab
Loading
@@ -36,7 +36,6 @@ module Gitlab
if: :has_rules? if: :has_rules?
   
with_options allow_nil: true do with_options allow_nil: true do
validates :tags, array_of_strings: true
validates :allow_failure, boolean: true validates :allow_failure, boolean: true
validates :parallel, numericality: { only_integer: true, validates :parallel, numericality: { only_integer: true,
greater_than_or_equal_to: 2, greater_than_or_equal_to: 2,
Loading
@@ -97,7 +96,7 @@ module Gitlab
Loading
@@ -97,7 +96,7 @@ module Gitlab
description: 'Services that will be used to execute this job.', description: 'Services that will be used to execute this job.',
inherit: true inherit: true
   
entry :interruptible, Entry::Boolean, entry :interruptible, ::Gitlab::Config::Entry::Boolean,
description: 'Set jobs interruptible value.', description: 'Set jobs interruptible value.',
inherit: true inherit: true
   
Loading
@@ -109,6 +108,10 @@ module Gitlab
Loading
@@ -109,6 +108,10 @@ module Gitlab
description: 'Retry configuration for this job.', description: 'Retry configuration for this job.',
inherit: true inherit: true
   
entry :tags, ::Gitlab::Config::Entry::ArrayOfStrings,
description: 'Set the tags.',
inherit: true
entry :only, Entry::Policy, entry :only, Entry::Policy,
description: 'Refs policy this job will be executed for.', description: 'Refs policy this job will be executed for.',
default: Entry::Policy::DEFAULT_ONLY, default: Entry::Policy::DEFAULT_ONLY,
Loading
Loading
# frozen_string_literal: true
module Gitlab
module Config
module Entry
##
# Entry that represents a array of strings value.
#
class ArrayOfStrings < Node
include Validatable
validations do
validates :config, array_of_strings: true
end
end
end
end
end
Loading
@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::Entry::Default do
Loading
@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::Entry::Default do
expect(described_class.nodes.keys) expect(described_class.nodes.keys)
.to match_array(%i[before_script image services .to match_array(%i[before_script image services
after_script cache interruptible after_script cache interruptible
timeout retry]) timeout retry tags])
end end
end end
end end
Loading
Loading
Loading
@@ -24,7 +24,7 @@ describe Gitlab::Ci::Config::Entry::Job do
Loading
@@ -24,7 +24,7 @@ describe Gitlab::Ci::Config::Entry::Job do
let(:result) do let(:result) do
%i[before_script script stage type after_script cache %i[before_script script stage type after_script cache
image services only except rules needs variables artifacts image services only except rules needs variables artifacts
environment coverage retry interruptible timeout] environment coverage retry interruptible timeout tags]
end end
   
it { is_expected.to match_array result } it { is_expected.to match_array result }
Loading
Loading
Loading
@@ -1849,7 +1849,7 @@ module Gitlab
Loading
@@ -1849,7 +1849,7 @@ module Gitlab
config = YAML.dump({ rspec: { script: "test", tags: "mysql" } }) config = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
expect do expect do
Gitlab::Ci::YamlProcessor.new(config) Gitlab::Ci::YamlProcessor.new(config)
end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec tags should be an array of strings") end.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, "jobs:rspec:tags config should be an array of strings")
end end
   
it "returns errors if before_script parameter is invalid" do it "returns errors if before_script parameter is invalid" do
Loading
@@ -2197,7 +2197,7 @@ module Gitlab
Loading
@@ -2197,7 +2197,7 @@ module Gitlab
context "when the tags parameter is invalid" do context "when the tags parameter is invalid" do
let(:content) { YAML.dump({ rspec: { script: "test", tags: "mysql" } }) } let(:content) { YAML.dump({ rspec: { script: "test", tags: "mysql" } }) }
   
it { is_expected.to eq "jobs:rspec tags should be an array of strings" } it { is_expected.to eq "jobs:rspec:tags config should be an array of strings" }
end end
   
context "when YAML content is empty" do context "when YAML content is empty" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment