ci/build: handle build timeout ourselves to give more time to nightly LTO builds

GitLab doesn't (yet) support `timeout:` being a variable, so let's put
the real `timeout:` at the max timeout we want, and internally use
another timeout (using coreutils' `timeout`) that we _can_ set using
a variable.

With that, we can set a 1h timeout on nightly LTO builds while keeping
our tighter 30min timeout the rest of the time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31846>
This commit is contained in:
Eric Engestrom
2023-09-01 13:28:36 +01:00
committed by Marge Bot
parent f5f82fdff5
commit 6425b6e3d4
2 changed files with 15 additions and 9 deletions

View File

@@ -46,6 +46,11 @@ workflow:
- if: &is-fork-push $CI_PROJECT_NAMESPACE != "mesa" && $CI_PIPELINE_SOURCE == "push"
# nightly pipeline
- if: &is-scheduled-pipeline $CI_PIPELINE_SOURCE == "schedule"
variables:
# (some) nightly builds perform LTO, so they take much longer than the
# short timeout allowed in other pipelines.
# Note: 0 = infinity = gitlab's job `timeout:` applies, which is 1h
BUILD_JOB_TIMEOUT_OVERRIDE: 0
# pipeline for direct pushes that bypassed the CI
- if: &is-direct-push $CI_PROJECT_NAMESPACE == "mesa" && $CI_PIPELINE_SOURCE == "push" && $GITLAB_USER_LOGIN != "marge-bot"
variables:

View File

@@ -3,14 +3,15 @@
extends: .container+build-rules
# Cancel job if a newer commit is pushed to the same branch
interruptible: true
variables:
# Build jobs don't take more than 1-3 minutes. 5-8 min max on a fresh runner
# without a populated ccache.
# These jobs are never slow, either they finish within reasonable time or
# something has gone wrong and the job will never terminate, so we should
# instead timeout so that the retry mechanism can kick in.
# A few exception are made, see `timeout:` overrides in the rest of this
# file.
timeout: 30m
# A few exception are made, see overrides in the rest of this file.
BUILD_JOB_TIMEOUT: 30m
timeout: 1h
# We don't want to download any previous job's artifacts
dependencies: []
artifacts:
@@ -60,7 +61,7 @@
variables:
LLVM_VERSION: 15
script:
- &meson-build .gitlab-ci/meson/build.sh
- &meson-build timeout --verbose ${BUILD_JOB_TIMEOUT_OVERRIDE:-$BUILD_JOB_TIMEOUT} .gitlab-ci/meson/build.sh
# Make sure this list stays the same as all the jobs with