Skip to content

Support Variable expansion for job timeout

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

We have certain tests that heavily vary in the terms of duration. For most of the jobs 15 minute will do, but for some of them even 30 is not always enough. Obviously we can just increase hardcoded timeout to let's say 1 hour, but that is completely non-flexible option as even for the shortest test, if something will be stuck in the loop, devs will see job failing after 1 hour. We would like to request possibility to have a variable in the job timeout field that can be changed by the developers.

Problem

  • As a developer using extends: for tests. I want to set a dynamic job timeout value when I know the test may need to run long, so I can avoid wasted CI and Wall Clock time.

Example of gitlab-ci.yml

.CD_PIPELINE_BRANCH_REFERENCE: &cd_pipeline_branch_name master
.INFRA_SCRIPT_BRANCH_REFERENCE: &infra_branch_name master

variables:
  INFRA_SCRIPT_BRANCH: *infra_branch_name
  CD_PIPELINE_BRANCH: *cd_pipeline_branch_name
  CI_PIPELINE_BRANCH: master
  PIPELINE_TYPE: "ms"
  **JOB_TIMEOUT**: 15 minutes

Where we set the variable JOB_TIMOEUT which can later be used in a code like:

e2e-test:
  extends:
    - .default_retry
  stage: test
timeout: **${JOB_TIMEOUT}**
  rules:
    - if: $E2E_STAGE == "False" || $E2E_STAGE == "false"
      when: never

I tried, but haven't found any actual workaround for this.

Edited by 🤖 GitLab Bot 🤖