GitLab CI Configuration Options: tags, allow_failure, when, manual, delayed, retry, timeout, and parallel
This tutorial explains how to use GitLab CI keywords such as tags, allow_failure, when, manual, delayed, retry, timeout, and parallel to control runner selection, job execution conditions, failure handling, scheduling, retry policies, time limits, and concurrent job instances within CI/CD pipelines.
In GitLab CI you can select specific runners using tags, for example assigning ruby and postgres tags to a runner.
Jobs can be limited to runners with matching tags, such as an OS X runner ( osx) or a Windows runner ( windows).
The allow_failure keyword lets a job fail without blocking the pipeline; failed jobs are shown with an orange warning but the pipeline continues.
job1:
stage: test
script:
- execute_script_that_will_fail
allow_failure: trueThe when keyword controls job execution timing: on_success (default) runs after all previous jobs succeed, on_failure runs when a previous job fails, always runs regardless, and manual requires manual triggering, often used for production deployments.
The delayed keyword schedules a job to run after a specified interval (e.g., 5 seconds, 30 minutes, 1 day).
The retry keyword defines how many times a failed job should be retried, with optional hash keys max and when to fine‑tune retry behavior for specific failure types.
unittest:
stage: test
retry: 2
script:
- ech "run test"The timeout keyword sets a maximum execution time for a job, which can exceed the project‑level timeout but not the runner‑level limit.
build:
script: build.sh
timeout: 3 hours 30 minutes
test:
script: rspec
timeout: 3h 30mProject‑wide pipeline timeout and runner‑specific timeout can be configured in the project settings under CI/CD → General pipelines.
The parallel keyword runs multiple instances of the same job concurrently (2‑50 instances), naming them sequentially.
codescan:
stage: codescan
tags:
- build
only:
- master
script:
- echo "codescan"
- sleep 5;
parallel: 5Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
