Commit 38bd0126 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'feat/increase-start-in' into 'master'

Increase CI job 'when delayed' limit to 1 week

Closes #28890

See merge request gitlab-org/gitlab!20323
parents bd024427 4f11dd77
---
title: Increase upper limit of start_in attribute to 1 week
merge_request: 20323
author: Will Layton
type: changed
......@@ -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.
......
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......
Markdown is supported
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