Skip to content

Commit 660d791

Browse files
authored
[ci] Update buildah command and version (#2058)
* [ci] Update buildah command and version * custom rules for build * fix naming * move all jobs to one stage * typo >_< * fix bridges-common-relay build image
1 parent e4535c0 commit 660d791

File tree

1 file changed

+88
-39
lines changed

1 file changed

+88
-39
lines changed

.gitlab-ci.yml

Lines changed: 88 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
stages:
2-
- lint
3-
- check
42
- test
53
- build
64
- publish
@@ -13,8 +11,9 @@ variables:
1311
CARGO_INCREMENTAL: 0
1412
ARCH: "x86_64"
1513
CI_IMAGE: "paritytech/bridges-ci:production"
16-
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27"
1714
RUST_BACKTRACE: full
15+
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29"
16+
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
1817

1918
default:
2019
cache: {}
@@ -50,23 +49,14 @@ default:
5049

5150
.test-refs: &test-refs
5251
rules:
53-
# FIXME: This is the cause why pipelines wouldn't start. The problem might be in our custom
54-
# mirroring. This should be investigated further, but for now let's have the working
55-
# pipeline.
56-
# - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH
57-
# changes:
58-
# - '**.md'
59-
# - diagrams/*
60-
# - docs/*
61-
# when: never
6252
- if: $CI_PIPELINE_SOURCE == "pipeline"
6353
- if: $CI_PIPELINE_SOURCE == "web"
6454
- if: $CI_PIPELINE_SOURCE == "schedule"
6555
- if: $CI_COMMIT_REF_NAME == "master"
6656
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
6757
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
6858

69-
.build-refs: &build-refs
59+
.publish-refs: &publish-refs
7060
rules:
7161
# won't run on the CI image update pipeline
7262
- if: $CI_PIPELINE_SOURCE == "pipeline"
@@ -78,6 +68,12 @@ default:
7868
# this job runs only on nightly pipeline with the mentioned variable, against `master` branch
7969
- if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly"
8070

71+
.nightly-test: &nightly-test
72+
rules:
73+
# 2. another is triggered by scripts repo $CI_PIPELINE_SOURCE == "pipeline" it's for the CI image
74+
# update, it also runs all the nightly checks.
75+
- if: $CI_PIPELINE_SOURCE == "pipeline"
76+
8177
.deploy-refs: &deploy-refs
8278
rules:
8379
- if: $CI_PIPELINE_SOURCE == "pipeline"
@@ -89,16 +85,12 @@ default:
8985
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]{4}-[0-9]{2}-[0-9]{2}.*$/ # i.e. v2021-09-27, v2021-09-27-1
9086
when: manual
9187

92-
.nightly-test: &nightly-test
93-
rules:
94-
# 2. another is triggered by scripts repo $CI_PIPELINE_SOURCE == "pipeline" it's for the CI image
95-
# update, it also runs all the nightly checks.
96-
- if: $CI_PIPELINE_SOURCE == "pipeline"
9788

98-
#### stage: lint
89+
90+
#### stage: test
9991

10092
clippy-nightly:
101-
stage: lint
93+
stage: test
10294
<<: *docker-env
10395
<<: *test-refs
10496
variables:
@@ -108,23 +100,21 @@ clippy-nightly:
108100
- SKIP_WASM_BUILD=1 cargo +nightly clippy --all-targets -- -A clippy::redundant_closure -A clippy::derive-partial-eq-without-eq -A clippy::or_fun_call
109101

110102
fmt:
111-
stage: lint
103+
stage: test
112104
<<: *docker-env
113105
<<: *test-refs
114106
script:
115107
- cargo +nightly fmt --all -- --check
116108

117109
spellcheck:
118-
stage: lint
110+
stage: test
119111
<<: *docker-env
120112
<<: *test-refs
121113
script:
122114
- cargo spellcheck check --cfg=.config/spellcheck.toml --checkers hunspell -m 1 $(find . -type f -name '*.rs' ! -path "./target/*" ! -name 'codegen_runtime.rs' ! -name 'weights.rs')
123115

124-
#### stage: check
125-
126116
check:
127-
stage: check
117+
stage: test
128118
<<: *docker-env
129119
<<: *test-refs
130120
script: &check-script
@@ -135,15 +125,13 @@ check:
135125
- SKIP_WASM_BUILD=1 time cargo check -p millau-runtime --locked --features runtime-benchmarks --verbose
136126

137127
check-nightly:
138-
stage: check
128+
stage: test
139129
<<: *docker-env
140130
<<: *nightly-test
141131
script:
142132
- rustup default nightly
143133
- *check-script
144134

145-
#### stage: test
146-
147135
test:
148136
stage: test
149137
<<: *docker-env
@@ -225,12 +213,17 @@ partial-repo-pallets-build-test:
225213
# we may live with failing partial repo build, it is just a signal for us
226214
allow_failure: true
227215

228-
#### stage: build
229-
230216
build:
231-
stage: build
217+
stage: test
218+
rules:
219+
# won't run on the CI image update pipeline
220+
- if: $CI_PIPELINE_SOURCE == "pipeline"
221+
when: never
222+
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
223+
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]{4}-[0-9]{2}-[0-9]{2}.*$/ # i.e. v2021-09-27, v2021-09-27-1
224+
- if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly"
225+
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
232226
<<: *docker-env
233-
<<: *build-refs
234227
<<: *collect-artifacts
235228
# master
236229
script: &build-script
@@ -264,10 +257,66 @@ build-nightly:
264257

265258
#### stage: publish
266259

260+
# check that images can be built
261+
.build-image: &build-image
262+
<<: *kubernetes-build
263+
image: $BUILDAH_IMAGE
264+
<<: *test-refs
265+
variables: &build-image-variables
266+
GIT_STRATEGY: none
267+
DOCKERFILE: ci.Dockerfile
268+
needs:
269+
- job: build
270+
artifacts: true
271+
script:
272+
# trim "-build-docker" from job name
273+
- export DOCKER_IMAGE_NAME="${CI_JOB_NAME::-13}"
274+
- if [[ "${CI_JOB_NAME::-13}" == "bridges-common-relay" ]]; then
275+
export BRIDGES_PROJECT="substrate-relay";
276+
else
277+
export BRIDGES_PROJECT="${CI_JOB_NAME::-13}";
278+
fi
279+
- export IMAGE_NAME=docker.io/paritytech/${DOCKER_IMAGE_NAME}
280+
- echo "Building ${IMAGE_NAME}"
281+
- cd ./artifacts
282+
- $BUILDAH_COMMAND build
283+
--format=docker
284+
--build-arg VCS_REF="${CI_COMMIT_SHORT_SHA}"
285+
--build-arg BUILD_DATE="$(date +%d-%m-%Y)"
286+
--build-arg PROJECT="${BRIDGES_PROJECT}"
287+
--build-arg VERSION="${VERSION}"
288+
--tag "${IMAGE_NAME}:latest"
289+
--file "${DOCKERFILE}" .
290+
291+
rialto-bridge-node-build-docker:
292+
stage: publish
293+
<<: *build-image
294+
295+
rialto-parachain-collator-build-docker:
296+
stage: publish
297+
<<: *build-image
298+
299+
millau-bridge-node-build-docker:
300+
stage: publish
301+
<<: *build-image
302+
303+
substrate-relay-build-docker:
304+
stage: publish
305+
<<: *build-image
306+
307+
bridges-common-relay-build-docker:
308+
stage: publish
309+
<<: *build-image
310+
variables:
311+
<<: *build-image-variables
312+
BRIDGES_PROJECT: substrate-relay
313+
DOCKER_IMAGE_NAME: bridges-common-relay
314+
315+
# build and publish images
267316
.build-push-image: &build-push-image
268317
<<: *kubernetes-build
269318
image: $BUILDAH_IMAGE
270-
<<: *build-refs
319+
<<: *publish-refs
271320
variables: &image-variables
272321
GIT_STRATEGY: none
273322
DOCKERFILE: ci.Dockerfile
@@ -297,7 +346,7 @@ build-nightly:
297346
- test "${Docker_Hub_User_Parity}" -a "${Docker_Hub_Pass_Parity}" ||
298347
( echo "no docker credentials provided"; exit 1 )
299348
- cd ./artifacts
300-
- buildah bud
349+
- $BUILDAH_COMMAND build
301350
--format=docker
302351
--build-arg VCS_REF="${CI_COMMIT_SHORT_SHA}"
303352
--build-arg BUILD_DATE="$(date +%d-%m-%Y)"
@@ -310,10 +359,10 @@ build-nightly:
310359
# The job will success only on the protected branch
311360
- echo "${Docker_Hub_Pass_Parity}" |
312361
buildah login --username "${Docker_Hub_User_Parity}" --password-stdin docker.io
313-
- buildah info
314-
- buildah push --format=v2s2 "${IMAGE_NAME}:${VERSION}"
315-
- buildah push --format=v2s2 "${IMAGE_NAME}:sha-${CI_COMMIT_SHORT_SHA}"
316-
- buildah push --format=v2s2 "${IMAGE_NAME}:${FLOATING_TAG}"
362+
- $BUILDAH_COMMAND info
363+
- $BUILDAH_COMMAND push --format=v2s2 "${IMAGE_NAME}:${VERSION}"
364+
- $BUILDAH_COMMAND push --format=v2s2 "${IMAGE_NAME}:sha-${CI_COMMIT_SHORT_SHA}"
365+
- $BUILDAH_COMMAND push --format=v2s2 "${IMAGE_NAME}:${FLOATING_TAG}"
317366
after_script:
318367
- env REGISTRY_AUTH_FILE= buildah logout --all
319368

@@ -343,7 +392,7 @@ bridges-common-relay:
343392

344393
# Publish Docker images description to hub.docker.com
345394

346-
.publish-docker-image-description: &publish-docker-image-description
395+
.publish-docker-image-description:
347396
stage: publish-docker-description
348397
image: paritytech/dockerhub-description
349398
variables:

0 commit comments

Comments
 (0)