Skip to content

Specify timeout per job in .gitlab-ci.yml

Problem to Solve

Different jobs have different execution characteristics, but the timeout on a per-job basis is not configurable. It would be very nice to be able to override the project default timeout specified in project settings in the projects ci config file.

Use Case

One example would be pushing docker image to remote repo. As part of a deploy process a docker image is pushed to a remote registry over a slow connection. As such, if the docker image is large, the job can take over an hour to complete. However, I don't want to set the project default timeout to something like 5 hours because all of the other jobs defined in the .gitlab-ci.yml config file complete much quicker and letting them stall for 5 hours would be too long.

Proposal

# .gitlab-ci.yml
timeout: 60 # timeout in minutes

build_job:
  timeout: 30

deploy_job:
  timeout: 180

Limitations

  • It should not be possible to specify a timeout longer than an instance-wide or runner-configured maximum timeout, otherwise it becomes an abuse vector for GitLab.com.
Edited by Jason Yavorsky