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
Loading
@@ -135,6 +135,7 @@ The following job parameters can be defined inside a `default:` block:
- [`services`](#services)
- [`before_script`](#before_script-and-after_script)
- [`after_script`](#before_script-and-after_script)
- [`tags`](#tags)
- [`cache`](#cache)
- [`retry`](#retry)
- [`timeout`](#timeout)
Loading
Loading
Loading
Loading
@@ -13,7 +13,8 @@ describe EE::Gitlab::Ci::Config::Entry::Bridge do
# that we know that we don't want to inherit
# as they do not have sense in context of Bridge
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
 
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
Loading
@@ -15,7 +15,7 @@ module Gitlab
 
ALLOWED_KEYS = %i[before_script image services
after_script cache interruptible
timeout retry].freeze
timeout retry tags].freeze
 
validations do
validates :config, allowed_keys: ALLOWED_KEYS
Loading
Loading
@@ -41,7 +41,7 @@ module Gitlab
description: 'Configure caching between build jobs.',
inherit: true
 
entry :interruptible, Entry::Boolean,
entry :interruptible, ::Gitlab::Config::Entry::Boolean,
description: 'Set jobs interruptible default value.',
inherit: false
 
Loading
Loading
@@ -53,7 +53,12 @@ module Gitlab
description: 'Set retry default value.',
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
 
Loading
Loading
Loading
Loading
@@ -36,7 +36,6 @@ module Gitlab
if: :has_rules?
 
with_options allow_nil: true do
validates :tags, array_of_strings: true
validates :allow_failure, boolean: true
validates :parallel, numericality: { only_integer: true,
greater_than_or_equal_to: 2,
Loading
Loading
@@ -97,7 +96,7 @@ module Gitlab
description: 'Services that will be used to execute this job.',
inherit: true
 
entry :interruptible, Entry::Boolean,
entry :interruptible, ::Gitlab::Config::Entry::Boolean,
description: 'Set jobs interruptible value.',
inherit: true
 
Loading
Loading
@@ -109,6 +108,10 @@ module Gitlab
description: 'Retry configuration for this job.',
inherit: true
 
entry :tags, ::Gitlab::Config::Entry::ArrayOfStrings,
description: 'Set the tags.',
inherit: true
entry :only, Entry::Policy,
description: 'Refs policy this job will be executed for.',
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
Loading
@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::Entry::Default do
expect(described_class.nodes.keys)
.to match_array(%i[before_script image services
after_script cache interruptible
timeout retry])
timeout retry tags])
end
end
end
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ describe Gitlab::Ci::Config::Entry::Job do
let(:result) do
%i[before_script script stage type after_script cache
image services only except rules needs variables artifacts
environment coverage retry interruptible timeout]
environment coverage retry interruptible timeout tags]
end
 
it { is_expected.to match_array result }
Loading
Loading
Loading
Loading
@@ -1849,7 +1849,7 @@ module Gitlab
config = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
expect do
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
 
it "returns errors if before_script parameter is invalid" do
Loading
Loading
@@ -2197,7 +2197,7 @@ module Gitlab
context "when the tags parameter is invalid" do
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
 
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