From 6425b6e3d4a29ae6a5b47864c68deb5723dfe6df Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 1 Sep 2023 13:28:36 +0100 Subject: [PATCH] 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: --- .gitlab-ci.yml | 5 +++++ .gitlab-ci/build/gitlab-ci.yml | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98d838e5bff..2abfa041dc6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml index 41520e43396..9d68add913a 100644 --- a/.gitlab-ci/build/gitlab-ci.yml +++ b/.gitlab-ci/build/gitlab-ci.yml @@ -3,14 +3,15 @@ extends: .container+build-rules # Cancel job if a newer commit is pushed to the same branch interruptible: true - # 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 + 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 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