Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 2e21c35

Browse files
authored
[ci] add job switcher (#12922)
1 parent 59b5903 commit 2e21c35

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

.gitlab-ci.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ default:
8181
paths:
8282
- artifacts/
8383

84+
.job-switcher:
85+
before_script:
86+
- if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi
87+
8488
.kubernetes-env:
8589
image: "${CI_IMAGE}"
90+
before_script:
91+
- !reference [.job-switcher, before_script]
8692
tags:
8793
- kubernetes-parity-build
8894

@@ -95,6 +101,7 @@ default:
95101

96102
.pipeline-stopper-vars:
97103
script:
104+
- !reference [.job-switcher, before_script]
98105
- echo "Collecting env variables for the cancel-pipeline job"
99106
- echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env
100107
- echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
@@ -110,6 +117,7 @@ default:
110117
before_script:
111118
# TODO: remove unset invocation when we'll be free from 'ENV RUSTC_WRAPPER=sccache' & sccache itself in all images
112119
- unset RUSTC_WRAPPER
120+
- !reference [.job-switcher, before_script]
113121
- !reference [.rust-info-script, script]
114122
- !reference [.rusty-cachier, before_script]
115123
- !reference [.pipeline-stopper-vars, script]
@@ -300,7 +308,6 @@ rusty-cachier-notify:
300308
PR_NUM: "${PR_NUM}"
301309
trigger:
302310
project: "parity/infrastructure/ci_cd/pipeline-stopper"
303-
branch: "as-improve"
304311

305312
remove-cancel-pipeline-message:
306313
stage: .post

scripts/ci/gitlab/pipeline/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ build-linux-substrate:
6262
- job: test-linux-stable
6363
artifacts: false
6464
before_script:
65+
- !reference [.job-switcher, before_script]
6566
- mkdir -p ./artifacts/substrate/
6667
- !reference [.rusty-cachier, before_script]
6768
# tldr: we need to checkout the branch HEAD explicitly because of our dynamic versioning approach while building the substrate binary
@@ -94,6 +95,7 @@ build-linux-substrate:
9495
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
9596
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
9697
before_script:
98+
- !reference [.job-switcher, before_script]
9799
- mkdir -p ./artifacts/subkey
98100
- !reference [.rusty-cachier, before_script]
99101
script:
@@ -118,6 +120,7 @@ build-subkey-macos:
118120
# duplicating before_script & script sections from .build-subkey hidden job
119121
# to overwrite rusty-cachier integration as it doesn't work on macos
120122
before_script:
123+
- !reference [.job-switcher, before_script]
121124
- mkdir -p ./artifacts/subkey
122125
script:
123126
- cd ./bin/utils/subkey

scripts/ci/gitlab/pipeline/publish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
DOCKERFILE: $PRODUCT.Dockerfile
1313
IMAGE_NAME: docker.io/$IMAGE_PATH
1414
before_script:
15+
- !reference [.job-switcher, before_script]
1516
- cd ./artifacts/$PRODUCT/
1617
- VERSION="$(cat ./VERSION)"
1718
- echo "${PRODUCT} version = ${VERSION}"

scripts/ci/gitlab/pipeline/test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ cargo-check-benches:
6565
before_script:
6666
# perform rusty-cachier operations before any further modifications to the git repo to make cargo feel cheated not so much
6767
- !reference [.rust-info-script, script]
68+
- !reference [.job-switcher, before_script]
6869
- !reference [.rusty-cachier, before_script]
6970
- !reference [.pipeline-stopper-vars, script]
7071
# merges in the master branch on PRs
@@ -414,6 +415,7 @@ cargo-check-each-crate-macos:
414415
- .collect-artifacts
415416
- .pipeline-stopper-artifacts
416417
before_script:
418+
- !reference [.job-switcher, before_script]
417419
- !reference [.rust-info-script, script]
418420
- !reference [.pipeline-stopper-vars, script]
419421
variables:

0 commit comments

Comments
 (0)