@@ -29,77 +29,81 @@ workflow:
2929 - if : $CI_COMMIT_BRANCH
3030
3131variables :
32- GIT_STRATEGY : fetch
33- GIT_DEPTH : 100
34- CI_SERVER_NAME : " GitLab CI"
35- CI_IMAGE : " paritytech/ci-linux:production"
36- BUILDAH_IMAGE : " quay.io/buildah/stable:v1.27"
37- DOCKER_OS : " debian:stretch"
38- ARCH : " x86_64"
39- ZOMBIENET_IMAGE : " docker.io/paritytech/zombienet:v1.2.78 "
32+ GIT_STRATEGY : fetch
33+ GIT_DEPTH : 100
34+ CI_SERVER_NAME : " GitLab CI"
35+ CI_IMAGE : " paritytech/ci-linux:production"
36+ BUILDAH_IMAGE : " quay.io/buildah/stable:v1.27"
37+ DOCKER_OS : " debian:stretch"
38+ ARCH : " x86_64"
39+ ZOMBIENET_IMAGE : " docker.io/paritytech/zombienet:v1.3.37 "
4040
4141default :
42- cache : {}
42+ cache : {}
4343 retry :
4444 max : 2
4545 when :
4646 - runner_system_failure
4747 - unknown_failure
4848 - api_failure
49- interruptible : true
49+ interruptible : true
50+
51+ .common-before-script :
52+ before_script :
53+ - !reference [.job-switcher, before_script]
54+ - !reference [.timestamp, before_script]
5055
5156.collect-artifacts :
5257 artifacts :
53- name : " ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
54- when : on_success
55- expire_in : 7 days
58+ name : " ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
59+ when : on_success
60+ expire_in : 7 days
5661 paths :
5762 - ./artifacts/
5863
5964.collect-artifacts-short :
6065 artifacts :
61- name : " ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
62- when : on_success
63- expire_in : 1 days
66+ name : " ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
67+ when : on_success
68+ expire_in : 1 days
6469 paths :
6570 - ./artifacts/
6671
6772# collecting vars for pipeline stopper
6873# they will be used if the job fails
6974.pipeline-stopper-vars :
7075 before_script :
71- - !reference [.job-switcher, before_script]
7276 - echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env
7377 - echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
7478 - echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
7579 - echo "PR_NUM=${CI_COMMIT_REF_NAME}" >> pipeline-stopper.env
7680
7781.pipeline-stopper-artifacts :
7882 artifacts :
79- reports :
80- dotenv : pipeline-stopper.env
83+ reports :
84+ dotenv : pipeline-stopper.env
8185
8286.job-switcher :
8387 before_script :
8488 - if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi
8589
8690.kubernetes-env :
87- image : " ${CI_IMAGE}"
91+ image : " ${CI_IMAGE}"
8892 before_script :
89- - !reference [.job-switcher , before_script]
93+ - !reference [.common-before-script , before_script]
9094 tags :
9195 - kubernetes-parity-build
9296
9397.docker-env :
94- image : " ${CI_IMAGE}"
98+ image : " ${CI_IMAGE}"
9599 before_script :
96- - !reference [.job-switcher , before_script]
100+ - !reference [.common-before-script , before_script]
97101 tags :
98102 - linux-docker-vm-c2
99103
100104.compiler-info :
101105 before_script :
102- - !reference [.job-switcher , before_script]
106+ - !reference [.common-before-script , before_script]
103107 - rustup show
104108 - cargo --version
105109
@@ -108,23 +112,23 @@ default:
108112 - if : $CI_PIPELINE_SOURCE == "web"
109113 - if : $CI_PIPELINE_SOURCE == "schedule"
110114 - if : $CI_COMMIT_REF_NAME == "master"
111- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
115+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
112116
113117.common-refs :
114118 # these jobs run always*
115119 rules :
116120 - if : $CI_PIPELINE_SOURCE == "web"
117121 - if : $CI_PIPELINE_SOURCE == "schedule"
118122 - if : $CI_COMMIT_REF_NAME == "master"
119- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
120- - if : $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
121- - if : $CI_COMMIT_REF_NAME =~ /^release-v[0-9]+\.[0-9]+.*$/ # i.e. release-v0.9.27
123+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
124+ - if : $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
125+ - if : $CI_COMMIT_REF_NAME =~ /^release-v[0-9]+\.[0-9]+.*$/ # i.e. release-v0.9.27
122126
123127.test-pr-refs :
124128 rules :
125129 - if : $CI_PIPELINE_SOURCE == "pipeline"
126130 when : never
127- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
131+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
128132
129133.zombienet-refs :
130134 rules :
@@ -133,7 +137,7 @@ default:
133137 - if : $CI_PIPELINE_SOURCE == "schedule"
134138 when : never
135139 - if : $CI_COMMIT_REF_NAME == "master"
136- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
140+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
137141
138142.deploy-testnet-refs :
139143 rules :
@@ -148,33 +152,33 @@ default:
148152 when : never
149153 - if : $CI_PIPELINE_SOURCE == "schedule"
150154 - if : $CI_PIPELINE_SOURCE == "web" &&
151- $CI_COMMIT_REF_NAME == "master"
155+ $CI_COMMIT_REF_NAME == "master"
152156 - if : $CI_COMMIT_REF_NAME == "master"
153- - if : $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
157+ - if : $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
154158
155159.build-push-image :
156160 before_script :
157- - !reference [.job-switcher , before_script]
161+ - !reference [.common-before-script , before_script]
158162 - test -s ./artifacts/VERSION || exit 1
159163 - test -s ./artifacts/EXTRATAG || exit 1
160164 - VERSION="$(cat ./artifacts/VERSION)"
161165 - EXTRATAG="$(cat ./artifacts/EXTRATAG)"
162166 - echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
163167 script :
164168 - test "$DOCKER_USER" -a "$DOCKER_PASS" ||
165- ( echo "no docker credentials provided"; exit 1 )
169+ ( echo "no docker credentials provided"; exit 1 )
166170 - cd ./artifacts
167171 - buildah bud
168- --format=docker
169- --build-arg VCS_REF="${CI_COMMIT_SHA}"
170- --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
171- --build-arg IMAGE_NAME="${IMAGE_NAME}"
172- --tag "$IMAGE_NAME:$VERSION"
173- --tag "$IMAGE_NAME:$EXTRATAG"
174- --file ${DOCKERFILE} .
172+ --format=docker
173+ --build-arg VCS_REF="${CI_COMMIT_SHA}"
174+ --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
175+ --build-arg IMAGE_NAME="${IMAGE_NAME}"
176+ --tag "$IMAGE_NAME:$VERSION"
177+ --tag "$IMAGE_NAME:$EXTRATAG"
178+ --file ${DOCKERFILE} .
175179 # The job will success only on the protected branch
176180 - echo "$DOCKER_PASS" |
177- buildah login --username "$DOCKER_USER" --password-stdin docker.io
181+ buildah login --username "$DOCKER_USER" --password-stdin docker.io
178182 - buildah info
179183 - buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
180184 - buildah push --format=v2s2 "$IMAGE_NAME:$EXTRATAG"
@@ -196,54 +200,57 @@ include:
196200 - scripts/ci/gitlab/pipeline/publish.yml
197201 # zombienet jobs
198202 - scripts/ci/gitlab/pipeline/zombienet.yml
203+ # timestamp handler
204+ - project : parity/infrastructure/ci_cd/shared
205+ ref : v0.1
206+ file : /common/timestamp.yml
199207
200208# ### stage: .post
201209
202210deploy-parity-testnet :
203- stage : .post
211+ stage : .post
204212 extends :
205213 - .deploy-testnet-refs
206214 variables :
207- POLKADOT_CI_COMMIT_NAME : " ${CI_COMMIT_REF_NAME}"
208- POLKADOT_CI_COMMIT_REF : " ${CI_COMMIT_SHORT_SHA}"
209- allow_failure : false
210- trigger : " parity/infrastructure/parity-testnet"
215+ POLKADOT_CI_COMMIT_NAME : " ${CI_COMMIT_REF_NAME}"
216+ POLKADOT_CI_COMMIT_REF : " ${CI_COMMIT_SHORT_SHA}"
217+ allow_failure : false
218+ trigger : " parity/infrastructure/parity-testnet"
211219
212220# This job cancels the whole pipeline if any of provided jobs fail.
213221# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
214222# to fail the pipeline as soon as possible to shorten the feedback loop.
215223.cancel-pipeline-template :
216- stage : .post
224+ stage : .post
217225 rules :
218- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
226+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
219227 when : on_failure
220228 variables :
221- PROJECT_ID : " ${CI_PROJECT_ID}"
222- PROJECT_NAME : " ${CI_PROJECT_NAME}"
223- PIPELINE_ID : " ${CI_PIPELINE_ID}"
224- FAILED_JOB_URL : " ${FAILED_JOB_URL}"
225- FAILED_JOB_NAME : " ${FAILED_JOB_NAME}"
226- PR_NUM : " ${PR_NUM}"
229+ PROJECT_ID : " ${CI_PROJECT_ID}"
230+ PROJECT_NAME : " ${CI_PROJECT_NAME}"
231+ PIPELINE_ID : " ${CI_PIPELINE_ID}"
232+ FAILED_JOB_URL : " ${FAILED_JOB_URL}"
233+ FAILED_JOB_NAME : " ${FAILED_JOB_NAME}"
234+ PR_NUM : " ${PR_NUM}"
227235 trigger :
228- project : " parity/infrastructure/ci_cd/pipeline-stopper"
229- branch : " as-improve"
236+ project : " parity/infrastructure/ci_cd/pipeline-stopper"
237+ branch : " as-improve"
230238
231239remove-cancel-pipeline-message :
232240 stage : .post
233241 rules :
234- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
242+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
235243 variables :
236- PROJECT_ID : " ${CI_PROJECT_ID}"
237- PROJECT_NAME : " ${CI_PROJECT_NAME}"
238- PIPELINE_ID : " ${CI_PIPELINE_ID}"
239- FAILED_JOB_URL : " https://gitlab.com"
240- FAILED_JOB_NAME : " nope"
241- PR_NUM : " ${CI_COMMIT_REF_NAME}"
244+ PROJECT_ID : " ${CI_PROJECT_ID}"
245+ PROJECT_NAME : " ${CI_PROJECT_NAME}"
246+ PIPELINE_ID : " ${CI_PIPELINE_ID}"
247+ FAILED_JOB_URL : " https://gitlab.com"
248+ FAILED_JOB_NAME : " nope"
249+ PR_NUM : " ${CI_COMMIT_REF_NAME}"
242250 trigger :
243- project : " parity/infrastructure/ci_cd/pipeline-stopper"
251+ project : " parity/infrastructure/ci_cd/pipeline-stopper"
244252
245253cancel-pipeline-test-linux-stable :
246- extends : .cancel-pipeline-template
254+ extends : .cancel-pipeline-template
247255 needs :
248- - job : test-linux-stable
249-
256+ - job : test-linux-stable
0 commit comments