Skip to content
Snippets Groups Projects
Commit 4f11dd77 authored by Will Layton's avatar Will Layton Committed by Kamil Trzciński
Browse files

Increase CI job 'when delayed' limit to 1 week

parent bd024427
No related branches found
No related tags found
No related merge requests found
---
title: Increase upper limit of start_in attribute to 1 week
merge_request: 20323
author: Will Layton
type: changed
Loading
Loading
@@ -1245,11 +1245,12 @@ Delayed job are for executing scripts after a certain period.
This is useful if you want to avoid jobs entering `pending` state immediately.
 
You can set the period with `start_in` key. The value of `start_in` key is an elapsed time in seconds, unless a unit is
provided. `start_in` key must be less than or equal to one hour. Examples of valid values include:
provided. `start_in` key must be less than or equal to one week. Examples of valid values include:
 
- `10 seconds`
- `30 minutes`
- `1 hour`
- `1 day`
- `1 week`
 
When there is a delayed job in a stage, the pipeline will not progress until the delayed job has finished.
This means this keyword can also be used for inserting delays between different stages.
Loading
Loading
Loading
Loading
@@ -51,7 +51,7 @@ module Gitlab
validates :rules, array_of_hashes: true
end
 
validates :start_in, duration: { limit: '1 day' }, if: :delayed?
validates :start_in, duration: { limit: '1 week' }, if: :delayed?
validates :start_in, absence: true, if: -> { has_rules? || !delayed? }
 
validate do
Loading
Loading
Loading
Loading
@@ -93,7 +93,7 @@ describe Gitlab::Ci::Config::Entry::Job do
 
context 'when delayed job' do
context 'when start_in is specified' do
let(:config) { { script: 'echo', when: 'delayed', start_in: '1 day' } }
let(:config) { { script: 'echo', when: 'delayed', start_in: '1 week' } }
 
it { expect(entry).to be_valid }
end
Loading
Loading
@@ -232,11 +232,9 @@ describe Gitlab::Ci::Config::Entry::Job do
 
context 'when delayed job' do
context 'when start_in is specified' do
let(:config) { { script: 'echo', when: 'delayed', start_in: '1 day' } }
let(:config) { { script: 'echo', when: 'delayed', start_in: '1 week' } }
 
it 'returns error about invalid type' do
expect(entry).to be_valid
end
it { expect(entry).to be_valid }
end
 
context 'when start_in is empty' do
Loading
Loading
@@ -257,8 +255,8 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
 
context 'when start_in is longer than one day' do
let(:config) { { when: 'delayed', start_in: '2 days' } }
context 'when start_in is longer than one week' do
let(:config) { { when: 'delayed', start_in: '8 days' } }
 
it 'returns error about exceeding the limit' do
expect(entry).not_to be_valid
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