@@ -29,77 +29,81 @@ workflow:
29
29
- if : $CI_COMMIT_BRANCH
30
30
31
31
variables :
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 "
40
40
41
41
default :
42
- cache : {}
42
+ cache : {}
43
43
retry :
44
44
max : 2
45
45
when :
46
46
- runner_system_failure
47
47
- unknown_failure
48
48
- 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]
50
55
51
56
.collect-artifacts :
52
57
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
56
61
paths :
57
62
- ./artifacts/
58
63
59
64
.collect-artifacts-short :
60
65
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
64
69
paths :
65
70
- ./artifacts/
66
71
67
72
# collecting vars for pipeline stopper
68
73
# they will be used if the job fails
69
74
.pipeline-stopper-vars :
70
75
before_script :
71
- - !reference [.job-switcher, before_script]
72
76
- echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env
73
77
- echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
74
78
- echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
75
79
- echo "PR_NUM=${CI_COMMIT_REF_NAME}" >> pipeline-stopper.env
76
80
77
81
.pipeline-stopper-artifacts :
78
82
artifacts :
79
- reports :
80
- dotenv : pipeline-stopper.env
83
+ reports :
84
+ dotenv : pipeline-stopper.env
81
85
82
86
.job-switcher :
83
87
before_script :
84
88
- if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi
85
89
86
90
.kubernetes-env :
87
- image : " ${CI_IMAGE}"
91
+ image : " ${CI_IMAGE}"
88
92
before_script :
89
- - !reference [.job-switcher , before_script]
93
+ - !reference [.common-before-script , before_script]
90
94
tags :
91
95
- kubernetes-parity-build
92
96
93
97
.docker-env :
94
- image : " ${CI_IMAGE}"
98
+ image : " ${CI_IMAGE}"
95
99
before_script :
96
- - !reference [.job-switcher , before_script]
100
+ - !reference [.common-before-script , before_script]
97
101
tags :
98
102
- linux-docker-vm-c2
99
103
100
104
.compiler-info :
101
105
before_script :
102
- - !reference [.job-switcher , before_script]
106
+ - !reference [.common-before-script , before_script]
103
107
- rustup show
104
108
- cargo --version
105
109
@@ -108,23 +112,23 @@ default:
108
112
- if : $CI_PIPELINE_SOURCE == "web"
109
113
- if : $CI_PIPELINE_SOURCE == "schedule"
110
114
- if : $CI_COMMIT_REF_NAME == "master"
111
- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
115
+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
112
116
113
117
.common-refs :
114
118
# these jobs run always*
115
119
rules :
116
120
- if : $CI_PIPELINE_SOURCE == "web"
117
121
- if : $CI_PIPELINE_SOURCE == "schedule"
118
122
- 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
122
126
123
127
.test-pr-refs :
124
128
rules :
125
129
- if : $CI_PIPELINE_SOURCE == "pipeline"
126
130
when : never
127
- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
131
+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
128
132
129
133
.zombienet-refs :
130
134
rules :
@@ -133,7 +137,7 @@ default:
133
137
- if : $CI_PIPELINE_SOURCE == "schedule"
134
138
when : never
135
139
- if : $CI_COMMIT_REF_NAME == "master"
136
- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
140
+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
137
141
138
142
.deploy-testnet-refs :
139
143
rules :
@@ -148,33 +152,33 @@ default:
148
152
when : never
149
153
- if : $CI_PIPELINE_SOURCE == "schedule"
150
154
- if : $CI_PIPELINE_SOURCE == "web" &&
151
- $CI_COMMIT_REF_NAME == "master"
155
+ $CI_COMMIT_REF_NAME == "master"
152
156
- 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
154
158
155
159
.build-push-image :
156
160
before_script :
157
- - !reference [.job-switcher , before_script]
161
+ - !reference [.common-before-script , before_script]
158
162
- test -s ./artifacts/VERSION || exit 1
159
163
- test -s ./artifacts/EXTRATAG || exit 1
160
164
- VERSION="$(cat ./artifacts/VERSION)"
161
165
- EXTRATAG="$(cat ./artifacts/EXTRATAG)"
162
166
- echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
163
167
script :
164
168
- test "$DOCKER_USER" -a "$DOCKER_PASS" ||
165
- ( echo "no docker credentials provided"; exit 1 )
169
+ ( echo "no docker credentials provided"; exit 1 )
166
170
- cd ./artifacts
167
171
- 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} .
175
179
# The job will success only on the protected branch
176
180
- echo "$DOCKER_PASS" |
177
- buildah login --username "$DOCKER_USER" --password-stdin docker.io
181
+ buildah login --username "$DOCKER_USER" --password-stdin docker.io
178
182
- buildah info
179
183
- buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
180
184
- buildah push --format=v2s2 "$IMAGE_NAME:$EXTRATAG"
@@ -196,54 +200,57 @@ include:
196
200
- scripts/ci/gitlab/pipeline/publish.yml
197
201
# zombienet jobs
198
202
- 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
199
207
200
208
# ### stage: .post
201
209
202
210
deploy-parity-testnet :
203
- stage : .post
211
+ stage : .post
204
212
extends :
205
213
- .deploy-testnet-refs
206
214
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"
211
219
212
220
# This job cancels the whole pipeline if any of provided jobs fail.
213
221
# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
214
222
# to fail the pipeline as soon as possible to shorten the feedback loop.
215
223
.cancel-pipeline-template :
216
- stage : .post
224
+ stage : .post
217
225
rules :
218
- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
226
+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
219
227
when : on_failure
220
228
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}"
227
235
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"
230
238
231
239
remove-cancel-pipeline-message :
232
240
stage : .post
233
241
rules :
234
- - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
242
+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
235
243
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}"
242
250
trigger :
243
- project : " parity/infrastructure/ci_cd/pipeline-stopper"
251
+ project : " parity/infrastructure/ci_cd/pipeline-stopper"
244
252
245
253
cancel-pipeline-test-linux-stable :
246
- extends : .cancel-pipeline-template
254
+ extends : .cancel-pipeline-template
247
255
needs :
248
- - job : test-linux-stable
249
-
256
+ - job : test-linux-stable
0 commit comments