Commit e042dc0a authored by Cédric Tabin's avatar Cédric Tabin
Browse files

Adds retry keyword in default values

parent 4a525497
......@@ -135,6 +135,7 @@ The following job parameters can be defined inside a `default:` block:
- [`before_script`](#before_script-and-after_script)
- [`after_script`](#before_script-and-after_script)
- [`cache`](#cache)
- [`retry`](#retry)
- [`timeout`](#timeout)
- [`interruptible`](#interruptible)
 
......
......@@ -13,7 +13,7 @@ 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]
%i[before_script after_script image services cache interruptible timeout retry]
end
end
 
......
......@@ -15,7 +15,7 @@ module Gitlab
 
ALLOWED_KEYS = %i[before_script image services
after_script cache interruptible
timeout].freeze
timeout retry].freeze
 
validations do
validates :config, allowed_keys: ALLOWED_KEYS
......@@ -49,7 +49,11 @@ module Gitlab
description: 'Set jobs default timeout.',
inherit: false
 
helpers :before_script, :image, :services, :after_script, :cache, :interruptible, :timeout
entry :retry, Entry::Retry,
description: 'Set retry default value.',
inherit: false
helpers :before_script, :image, :services, :after_script, :cache, :interruptible, :timeout, :retry
 
private
 
......
......@@ -105,6 +105,10 @@ module Gitlab
description: 'Timeout duration of this job.',
inherit: true
 
entry :retry, Entry::Retry,
description: 'Retry configuration for this job.',
inherit: true
entry :only, Entry::Policy,
description: 'Refs policy this job will be executed for.',
default: Entry::Policy::DEFAULT_ONLY,
......@@ -142,10 +146,6 @@ module Gitlab
description: 'Coverage configuration for this job.',
inherit: false
 
entry :retry, Entry::Retry,
description: 'Retry configuration for this job.',
inherit: false
helpers :before_script, :script, :stage, :type, :after_script,
:cache, :image, :services, :only, :except, :variables,
:artifacts, :environment, :coverage, :retry, :rules,
......
......@@ -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])
timeout retry])
end
end
end
......
......@@ -149,6 +149,28 @@ module Gitlab
expect(subject[:options]).not_to have_key(:retry)
end
end
context 'when retry count is specified by default' do
let(:config) do
YAML.dump(default: { retry: { max: 1 } },
rspec: { script: 'rspec' })
end
it 'does use the default value' do
expect(subject[:options]).to include(retry: { max: 1 })
end
end
context 'when retry count default value is overridden' do
let(:config) do
YAML.dump(default: { retry: { max: 1 } },
rspec: { script: 'rspec', retry: { max: 2 } })
end
it 'does use the job value' do
expect(subject[:options]).to include(retry: { max: 2 })
end
end
end
 
describe 'allow failure entry' do
......
Supports Markdown
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