Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab CI Pipeline Stage Timeout

I'm using a self-hosted GitLab CI server (community edition v8.9.5) and gitlab-ci-multi-runner 1.2.0 to build a project. One of my pipeline stages (test) takes a while to run and I get the following erm:

ERROR: Build failed: execution took longer than 3600 seconds 

Where do I put the override for this timeout? Can I apply it to just the test pipeline stage?

like image 850
Jackpot Avatar asked Jul 15 '16 19:07

Jackpot


People also ask

What is stage in GitLab CI?

History of stages in GitLab CI/CD By default, stages are ordered as: build , test , and deploy - so all stages execute in a logical order that matches a development workflow. The first step is to build the code, and if that works, the next step is to test it. If the tests pass, then you deploy the application.

What is Before_script in GitLab CI?

These are scripts that you choose to be run before the job is executed or after the job is executed. These can also be defined at the top level of the YAML file (where jobs are defined) and they'll apply to all jobs in the . gitlab-ci. yml file.

What is Git_strategy none?

variables: GIT_STRATEGY: fetch. none also re-uses the project workspace, but skips all Git operations (including GitLab Runner's pre-clone script, if present). It is mostly useful for jobs that operate exclusively on artifacts (e.g., deploy ).

What is Ci_commit_tag?

CI_COMMIT_TAG - The commit tag name. Present only when building tags. Therefore in the variables section CI_COMMIT_TAG is not defined, hence equals to "". So if you want to use CI_COMMIT_TAG use in job where tags are defined.


2 Answers

You can set a global timeout in "Project settings -> CI/CD Pipelines -> Timeout" or "Project settings -> Builds -> Timeout" in older versions.

As of version 12.3, you can set a timeout per stage in your CI .yml file using timeout:

timeout allows you to configure a timeout for a specific job. For example:

build:   script: build.sh   timeout: 3 hours 30 minutes  test:   script: rspec   timeout: 3h 30m 

The job-level timeout can exceed the project-level timeout but can’t exceed the Runner-specific timeout.

like image 50
tmt Avatar answered Sep 18 '22 11:09

tmt


There are two timeout can be set: project timeout and runner timeout.

Project timeout:

It is possible to set timeout per job from Settings -> CI/CD -> General pipelines

enter image description here

Runner timeout:

runner's timeout can be set from Settings -> CI/CD -> Runners, select the runner from Runners activated for this project and edit the Maximum job timeout from the runner edit form. enter image description here

Be aware that these two types of timeout can be overridden by each other. Refer the docs.

like image 29
Chuan Avatar answered Sep 16 '22 11:09

Chuan