From ee1760aae61373c6e95f96887f1258fed1010f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Gilbert?= Date: Thu, 9 Feb 2023 17:49:57 +0100 Subject: [PATCH] Tagged runner system This allows us to set the variable TAGGED_RUNNERS to run most jobs on runners with some tags (exceptions: the bench, the docker job). Then we can enable shared runners permanently for the docker job without them being enabled for other jobs. (cherry picked from commit 18d7ebc443d840feec36bc0b6eff0035553e7c47) --- .gitlab-ci.yml | 20 ++++++++++++++++++++ dev/ci/gitlab-modes/normal-mode.yml | 2 ++ dev/ci/gitlab-modes/protected-mode.yml | 2 ++ dev/ci/gitlab-modes/tagged-runners.yml | 3 +++ dev/ci/gitlab-modes/untagged-runners.yml | 2 ++ 5 files changed, 29 insertions(+) create mode 100644 dev/ci/gitlab-modes/tagged-runners.yml create mode 100644 dev/ci/gitlab-modes/untagged-runners.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e4b1f9816d6..068554f08ba9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,14 @@ include: rules: - if: $CI_COMMIT_BRANCH != "master" && $CI_COMMIT_BRANCH !~ /^v.*\..*$/ + - local: "/dev/ci/gitlab-modes/tagged-runners.yml" + rules: + - if: $TAGGED_RUNNERS + + - local: "/dev/ci/gitlab-modes/untagged-runners.yml" + rules: + - if: $TAGGED_RUNNERS == null + - local: '/dev/bench/gitlab-bench.yml' stages: @@ -55,6 +63,7 @@ before_script: .build-template: stage: build interruptible: true + extends: .auto-use-tags variables: COQIDE: "opt" artifacts: @@ -92,6 +101,7 @@ before_script: .build-template:dev: stage: build interruptible: true + extends: .auto-use-tags script: # flambda can be pretty stack hungry, specially with -O3 # See also https://github.com/ocaml/ocaml/issues/7842#issuecomment-596863244 @@ -117,6 +127,7 @@ before_script: .dev-ci-template: stage: build interruptible: true + extends: .auto-use-tags needs: - build:edge+flambda:dev script: @@ -139,6 +150,7 @@ before_script: .test-suite-template: stage: build interruptible: true + extends: .auto-use-tags needs: - not-a-real-job script: @@ -161,6 +173,7 @@ before_script: .validate-template: stage: build interruptible: true + extends: .auto-use-tags needs: - not-a-real-job script: @@ -183,6 +196,7 @@ before_script: .ci-template: stage: build interruptible: true + extends: .auto-use-tags script: - ulimit -S -s 16384 # For flambda + native - make -f Makefile.ci -j "$NJOBS" "${CI_JOB_NAME#*:}" @@ -207,6 +221,7 @@ before_script: .deploy-template: stage: deploy + extends: .auto-use-tags before_script: - which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y ) - eval $(ssh-agent -s) @@ -219,6 +234,7 @@ before_script: .pkg:opam-template: stage: build interruptible: true + extends: .auto-use-tags # OPAM will build out-of-tree so no point in importing artifacts script: - opam pin add --kind=path coq-core.dev . @@ -235,6 +251,7 @@ before_script: needs: [] interruptible: true image: nixos/nix:latest + extends: .auto-use-tags variables: GIT_STRATEGY: none # Required because we don't have git USER: root # Variable required by Cachix @@ -345,6 +362,7 @@ build:vio: lint: stage: build script: dev/lint-repository.sh + extends: .auto-use-tags variables: GIT_DEPTH: "" # we need an unknown amount of history for per-commit linting OPAM_SWITCH: "edge" @@ -493,6 +511,7 @@ test-suite:edge+flambda: test-suite:edge:dev: stage: build interruptible: true + extends: .auto-use-tags needs: - build:edge+flambda:dev script: @@ -847,6 +866,7 @@ plugin:ci-perennial: plugin:plugin-tutorial: stage: build interruptible: true + extends: .auto-use-tags script: - ./configure -prefix "$(pwd)/_install_ci" -warn-error yes - make -j "$NJOBS" plugin-tutorial diff --git a/dev/ci/gitlab-modes/normal-mode.yml b/dev/ci/gitlab-modes/normal-mode.yml index 9b2f10a6eac7..1a2de2e54025 100644 --- a/dev/ci/gitlab-modes/normal-mode.yml +++ b/dev/ci/gitlab-modes/normal-mode.yml @@ -2,3 +2,5 @@ default: interruptible: true timeout: 1h + tags: + - not-a-real-tag diff --git a/dev/ci/gitlab-modes/protected-mode.yml b/dev/ci/gitlab-modes/protected-mode.yml index 2b76d93bcd4e..8aedb62f43e9 100644 --- a/dev/ci/gitlab-modes/protected-mode.yml +++ b/dev/ci/gitlab-modes/protected-mode.yml @@ -2,3 +2,5 @@ default: interruptible: false timeout: 1h + tags: + - not-a-real-tag diff --git a/dev/ci/gitlab-modes/tagged-runners.yml b/dev/ci/gitlab-modes/tagged-runners.yml new file mode 100644 index 000000000000..7d80135b3f4b --- /dev/null +++ b/dev/ci/gitlab-modes/tagged-runners.yml @@ -0,0 +1,3 @@ +.auto-use-tags: + tags: + - $TAGGED_RUNNERS diff --git a/dev/ci/gitlab-modes/untagged-runners.yml b/dev/ci/gitlab-modes/untagged-runners.yml new file mode 100644 index 000000000000..652c18e75634 --- /dev/null +++ b/dev/ci/gitlab-modes/untagged-runners.yml @@ -0,0 +1,2 @@ +.auto-use-tags: + tags: []