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

Adds retry keyword in default values

parent 4a525497
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:
- [`before_script`](#before_script-and-after_script)
- [`after_script`](#before_script-and-after_script)
- [`cache`](#cache)
- [`retry`](#retry)
- [`timeout`](#timeout)
- [`interruptible`](#interruptible)
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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,
Loading
Loading
@@ -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,
Loading
Loading
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])
timeout retry])
end
end
end
Loading
Loading
Loading
Loading
@@ -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
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