Skip to content

Commit 6e394f8

Browse files
authored
[ci] Add missing components to CI (#1201)
* [ci] Add missing components to CI * add timestamp * add pipeline-stopper-artifacts to jobs * break clippy * mv definition * fix clippy * comment timestamp, rm verbose * commen cancel * rm --verbose from build jobs * disable rusty-cachier before_script * enable timestamp back * rollback .gitignore * rollback .gitignore * rollback .gitignore
1 parent c168a77 commit 6e394f8

File tree

4 files changed

+161
-63
lines changed

4 files changed

+161
-63
lines changed

.gitlab-ci.yml

Lines changed: 144 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
1-
# .gitlab-ci.yml
1+
# polkadot-sdk | CI definitions (via GitLab CI)
22
#
3-
# substrate
3+
# FYI: Pipelines can be triggered manually through the web UI (if you have enough permissions)
44
#
5-
# pipelines can be triggered manually in the web
6-
#
7-
# Currently the file is divided into subfiles. Each stage has a different file which
8-
# can be found here: gitlab/pipeline/<stage_name>.yml
9-
#
10-
# Instead of YAML anchors "extends" is used.
11-
# Useful links:
12-
# https://docs.gitlab.com/ee/ci/yaml/index.html#extends
13-
# https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#reference-tags
14-
#
15-
# SAMPLE JOB TEMPLATE - This is not a complete example but is enough to build a
16-
# simple CI job. For full documentation, visit https://docs.gitlab.com/ee/ci/yaml/
17-
#
18-
# my-example-job:
19-
# stage: test # One of the stages listed below this job (required)
20-
# image: paritytech/tools:latest # Any docker image (required)
21-
# allow_failure: true # Allow the pipeline to continue if this job fails (default: false)
22-
# needs:
23-
# - job: test-linux # Any jobs that are required to run before this job (optional)
24-
# variables:
25-
# MY_ENVIRONMENT_VARIABLE: "some useful value" # Environment variables passed to the job (optional)
26-
# script:
27-
# - echo "List of shell commands to run in your job"
28-
# - echo "You can also just specify a script here, like so:"
29-
# - ./gitlab/my_amazing_script.sh
5+
# Currently, entire CI instructions are split into different subfiles. Each CI stage has a corresponding
6+
# file which can be found here: .gitlab/pipeline/<stage_name>.yml
307

318
stages:
329
- check
@@ -84,23 +61,26 @@ default:
8461

8562
.prepare-env:
8663
before_script:
87-
# TODO: remove unset invocation when we'll be free from 'ENV RUSTC_WRAPPER=sccache' & sccache
88-
# itself in all images
89-
- unset RUSTC_WRAPPER
9064
# $WASM_BUILD_WORKSPACE_HINT enables wasm-builder to find the Cargo.lock from within generated
9165
# packages
9266
- export WASM_BUILD_WORKSPACE_HINT="$PWD"
9367
# ensure that RUSTFLAGS are set correctly
9468
- echo $RUSTFLAGS
9569

70+
.common-before-script:
71+
before_script:
72+
- !reference [.job-switcher, before_script]
73+
- !reference [.timestamp, before_script]
74+
- !reference [.pipeline-stopper-vars, script]
75+
9676
.job-switcher:
9777
before_script:
9878
- if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi
9979

10080
.kubernetes-env:
10181
image: "${CI_IMAGE}"
10282
before_script:
103-
# - !reference [.job-switcher, before_script]
83+
- !reference [.common-before-script, before_script]
10484
- !reference [.prepare-env, before_script]
10585
tags:
10686
- kubernetes-parity-build
@@ -112,9 +92,10 @@ default:
11292
- rustup +nightly show
11393
- cargo +nightly --version
11494

95+
# collecting vars for pipeline stopper
96+
# they will be used if the job fails
11597
.pipeline-stopper-vars:
11698
script:
117-
- !reference [.job-switcher, before_script]
11899
- echo "Collecting env variables for the cancel-pipeline job"
119100
- echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env
120101
- echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
@@ -128,28 +109,26 @@ default:
128109
.docker-env:
129110
image: "${CI_IMAGE}"
130111
before_script:
131-
- !reference [.job-switcher, before_script]
112+
- !reference [.common-before-script, before_script]
132113
- !reference [.prepare-env, before_script]
133114
- !reference [.rust-info-script, script]
134115
- !reference [.rusty-cachier, before_script]
135-
- !reference [.pipeline-stopper-vars, script]
136-
after_script:
137-
- !reference [.rusty-cachier, after_script]
138116
tags:
139117
- linux-docker-vm-c2
140118

141119
# rusty-cachier's hidden job. Parts of this job are used to instrument the pipeline's other real jobs with rusty-cachier
142-
# Description of the commands is available here - https://gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client#description
120+
# rusty-cachier's commands are described here: https://gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client#description
143121
.rusty-cachier:
144122
before_script:
145123
# - curl -s https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client/-/raw/release/util/install.sh | bash
146-
# - rusty-cachier environment check --gracefully
147-
# - $(rusty-cachier environment inject)
148-
# - rusty-cachier project mtime
124+
# - mkdir -p cargo_home cargo_target_dir
125+
# - export CARGO_HOME=$CI_PROJECT_DIR/cargo_home
126+
# - export CARGO_TARGET_DIR=$CI_PROJECT_DIR/cargo_target_dir
127+
# - find . \( -path ./cargo_target_dir -o -path ./cargo_home \) -prune -o -type f -exec touch -t 202005260100 {} +
128+
# - git restore-mtime
129+
# - rusty-cachier --version
130+
# - rusty-cachier project touch-changed
149131
- echo tbd
150-
after_script:
151-
- echo tbd
152-
# - env RUSTY_CACHIER_SUPRESS_OUTPUT=true rusty-cachier snapshot destroy
153132

154133
.common-refs:
155134
rules:
@@ -233,6 +212,125 @@ include:
233212
# zombienet jobs
234213
- .gitlab/pipeline/zombienet.yml
235214
# # timestamp handler
236-
# - project: parity/infrastructure/ci_cd/shared
237-
# ref: v0.2
238-
# file: /common/timestamp.yml
215+
- project: parity/infrastructure/ci_cd/shared
216+
ref: v0.2
217+
file: /common/timestamp.yml
218+
219+
# This job cancels the whole pipeline if any of provided jobs fail.
220+
# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
221+
# to fail the pipeline as soon as possible to shorten the feedback loop.
222+
.cancel-pipeline-template:
223+
stage: .post
224+
rules:
225+
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
226+
when: on_failure
227+
variables:
228+
PROJECT_ID: "${CI_PROJECT_ID}"
229+
PROJECT_NAME: "${CI_PROJECT_NAME}"
230+
PIPELINE_ID: "${CI_PIPELINE_ID}"
231+
FAILED_JOB_URL: "${FAILED_JOB_URL}"
232+
FAILED_JOB_NAME: "${FAILED_JOB_NAME}"
233+
PR_NUM: "${PR_NUM}"
234+
trigger:
235+
project: "parity/infrastructure/ci_cd/pipeline-stopper"
236+
branch: "as-improve"
237+
238+
remove-cancel-pipeline-message:
239+
stage: .post
240+
rules:
241+
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
242+
variables:
243+
PROJECT_ID: "${CI_PROJECT_ID}"
244+
PROJECT_NAME: "${CI_PROJECT_NAME}"
245+
PIPELINE_ID: "${CI_PIPELINE_ID}"
246+
FAILED_JOB_URL: "https://gitlab.com"
247+
FAILED_JOB_NAME: "nope"
248+
PR_NUM: "${CI_COMMIT_REF_NAME}"
249+
trigger:
250+
project: "parity/infrastructure/ci_cd/pipeline-stopper"
251+
# need to copy jobs this way because otherwise gitlab will wait
252+
# for all 3 jobs to finish instead of cancelling if one fails
253+
cancel-pipeline-test-linux-stable1:
254+
extends: .cancel-pipeline-template
255+
needs:
256+
- job: "test-linux-stable 1/3"
257+
258+
cancel-pipeline-test-linux-stable2:
259+
extends: .cancel-pipeline-template
260+
needs:
261+
- job: "test-linux-stable 2/3"
262+
263+
cancel-pipeline-test-linux-stable3:
264+
extends: .cancel-pipeline-template
265+
needs:
266+
- job: "test-linux-stable 3/3"
267+
268+
cancel-pipeline-test-linux-stable-additional-tests:
269+
extends: .cancel-pipeline-template
270+
needs:
271+
- job: "test-linux-stable-additional-tests"
272+
273+
cancel-pipeline-test-linux-stable-slow:
274+
extends: .cancel-pipeline-template
275+
needs:
276+
- job: "test-linux-stable-slow"
277+
278+
cancel-pipeline-cargo-check-benches1:
279+
extends: .cancel-pipeline-template
280+
needs:
281+
- job: "cargo-check-benches 1/2"
282+
283+
cancel-pipeline-cargo-check-benches2:
284+
extends: .cancel-pipeline-template
285+
needs:
286+
- job: "cargo-check-benches 2/2"
287+
288+
cancel-pipeline-test-linux-stable-int:
289+
extends: .cancel-pipeline-template
290+
needs:
291+
- job: test-linux-stable-int
292+
293+
cancel-pipeline-cargo-check-each-crate-1:
294+
extends: .cancel-pipeline-template
295+
needs:
296+
- job: "cargo-check-each-crate 1/6"
297+
298+
cancel-pipeline-cargo-check-each-crate-2:
299+
extends: .cancel-pipeline-template
300+
needs:
301+
- job: "cargo-check-each-crate 2/6"
302+
303+
cancel-pipeline-cargo-check-each-crate-3:
304+
extends: .cancel-pipeline-template
305+
needs:
306+
- job: "cargo-check-each-crate 3/6"
307+
308+
cancel-pipeline-cargo-check-each-crate-4:
309+
extends: .cancel-pipeline-template
310+
needs:
311+
- job: "cargo-check-each-crate 4/6"
312+
313+
cancel-pipeline-cargo-check-each-crate-5:
314+
extends: .cancel-pipeline-template
315+
needs:
316+
- job: "cargo-check-each-crate 5/6"
317+
318+
cancel-pipeline-cargo-check-each-crate-6:
319+
extends: .cancel-pipeline-template
320+
needs:
321+
- job: "cargo-check-each-crate 6/6"
322+
323+
cancel-pipeline-cargo-check-each-crate-macos:
324+
extends: .cancel-pipeline-template
325+
needs:
326+
- job: cargo-check-each-crate-macos
327+
328+
cancel-pipeline-check-tracing:
329+
extends: .cancel-pipeline-template
330+
needs:
331+
- job: check-tracing
332+
333+
cancel-pipeline-cargo-clippy:
334+
extends: .cancel-pipeline-template
335+
needs:
336+
- job: cargo-clippy

.gitlab/pipeline/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ build-test-collators:
4646
- .run-immediately
4747
- .collect-artifacts
4848
script:
49-
- time cargo build --locked --profile testnet --verbose -p test-parachain-adder-collator
50-
- time cargo build --locked --profile testnet --verbose -p test-parachain-undying-collator
49+
- time cargo build --locked --profile testnet -p test-parachain-adder-collator
50+
- time cargo build --locked --profile testnet -p test-parachain-undying-collator
5151
# pack artifacts
5252
- mkdir -p ./artifacts
5353
- mv ./target/testnet/adder-collator ./artifacts/.
@@ -66,7 +66,7 @@ build-malus:
6666
- .run-immediately
6767
- .collect-artifacts
6868
script:
69-
- time cargo build --locked --profile testnet --verbose -p polkadot-test-malus --bin malus --bin polkadot-prepare-worker --bin polkadot-execute-worker
69+
- time cargo build --locked --profile testnet -p polkadot-test-malus --bin malus --bin polkadot-prepare-worker --bin polkadot-execute-worker
7070
# pack artifacts
7171
- mkdir -p ./artifacts
7272
- mv ./target/testnet/malus ./artifacts/.
@@ -111,7 +111,7 @@ build-rustdoc:
111111
script:
112112
# FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features`
113113
# FIXME: return to stable when https://github.com/rust-lang/rust/issues/96937 gets into stable
114-
- time cargo doc --workspace --verbose --no-deps
114+
- time cargo doc --workspace --no-deps
115115
- rm -f ./target/doc/.lock
116116
- mv ./target/doc ./crate-docs
117117
# FIXME: remove me after CI image gets nonroot
@@ -280,7 +280,7 @@ build-linux-substrate:
280280
# see https://github.com/paritytech/ci_cd/issues/682#issuecomment-1340953589
281281
- git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
282282
script:
283-
- WASM_BUILD_NO_COLOR=1 time cargo build --locked --release --verbose
283+
- WASM_BUILD_NO_COLOR=1 time cargo build --locked --release
284284
- mv $CARGO_TARGET_DIR/release/substrate-node ./artifacts/substrate/substrate
285285
- echo -n "Substrate version = "
286286
- if [ "${CI_COMMIT_TAG}" ]; then
@@ -308,7 +308,7 @@ build-linux-substrate:
308308
- mkdir -p ./artifacts/subkey
309309
script:
310310
- cd ./substrate/bin/utils/subkey
311-
- SKIP_WASM_BUILD=1 time cargo build --locked --release --verbose
311+
- SKIP_WASM_BUILD=1 time cargo build --locked --release
312312
# - cd -
313313
# - mv $CARGO_TARGET_DIR/release/subkey ./artifacts/subkey/.
314314
# - echo -n "Subkey version = "
@@ -331,7 +331,7 @@ build-subkey-linux:
331331
# - mkdir -p ./artifacts/subkey
332332
# script:
333333
# - cd ./bin/utils/subkey
334-
# - SKIP_WASM_BUILD=1 time cargo build --locked --release --verbose
334+
# - SKIP_WASM_BUILD=1 time cargo build --locked --release
335335
# - cd -
336336
# - mv ./target/release/subkey ./artifacts/subkey/.
337337
# - echo -n "Subkey version = "

.gitlab/pipeline/check.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ cargo-clippy:
33
extends:
44
- .docker-env
55
- .common-refs
6+
- .pipeline-stopper-artifacts
67
script:
78
- SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --all-targets --locked --workspace
8-
# fixme!
9-
allow_failure: true
109

1110
check-try-runtime:
1211
stage: check
@@ -43,7 +42,6 @@ cargo-deny-licenses:
4342
script:
4443
- $CARGO_DENY_CMD --hide-inclusion-graph
4544
after_script:
46-
# - !reference [.rusty-cachier, after_script]
4745
- echo "___The complete log is in the artifacts___"
4846
- $CARGO_DENY_CMD 2> deny.log
4947
- if [ $CI_JOB_STATUS != 'success' ]; then

0 commit comments

Comments
 (0)