forked from paritytech/zombienet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
302 lines (268 loc) · 8.56 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
default:
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
interruptible: true
stages:
- build
- test
- check
- publish
- deploy
variables:
CI_IMAGE: "node:18"
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27"
DOCKERFILE: scripts/ci/docker/zombienet_injected.Dockerfile
DOCKERHUB_REPO: paritytech
IMAGE_NAME: $DOCKERHUB_REPO/zombienet
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29"
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
.kubernetes-env: &kubernetes-env
image: $CI_IMAGE
tags:
- kubernetes-parity-build
# run jobs only on PRs
.test-refs: &test-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
# run jobs always
.common-refs: &common-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "main"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
# run jobs only on master and publish
.publish-refs: &publish-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "main"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
# telling gitlab to collect artifacts from artifacts/ folder to path it to other jobs
.collect-artifacts: &collect-artifacts
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 2 days
paths:
- artifacts/
test:
stage: test
<<: *kubernetes-env
<<: *common-refs
<<: *collect-artifacts
script:
- mkdir -p artifacts
- cd javascript
- npm install
# - npm run test
- echo testme
- cp -r packages/ ../artifacts/
- cp package.json ../artifacts/
- cp package-lock.json ../artifacts/
- ls -ltr ../artifacts/*
build:
stage: build
<<: *kubernetes-env
<<: *common-refs
<<: *collect-artifacts
script:
- mkdir -p artifacts
- cd javascript
- npm install
- npm run clean
- npm run build
- cp -r packages/ ../artifacts/
- cp package.json ../artifacts/
- cp package-lock.json ../artifacts/
# template task for building and pushing an image
.build-push-docker-image: &build-push-docker-image
script:
- test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" ||
( echo "no docker credentials provided"; exit 1 )
- $BUILDAH_COMMAND build
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg VERSION="$VERSION"
--tag "$IMAGE_NAME:$VERSION"
--tag "$IMAGE_NAME:latest"
--file "$DOCKERFILE" .
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin docker.io
- $BUILDAH_COMMAND info
- echo "Effective tags = ${VERSION} latest"
- $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:$VERSION"
- $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:latest"
after_script:
- buildah logout --all
#check that the image can be build
publish-test:
stage: check
<<: *test-refs
<<: *kubernetes-env
variables:
CI_IMAGE: $BUILDAH_IMAGE
script:
- $BUILDAH_COMMAND build
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg VERSION="${CI_COMMIT_SHORT_SHA}"
--tag "$IMAGE_NAME:latest"
--file "$DOCKERFILE" .
publish-docker-pr:
stage: publish
variables:
CI_IMAGE: $BUILDAH_IMAGE
DOCKERHUB_REPO: paritypr
before_script:
- export VERSION=${CI_COMMIT_SHORT_SHA}
- export Docker_Hub_User_Parity=$PARITYPR_USER
- export Docker_Hub_Pass_Parity=$PARITYPR_PASS
<<: *kubernetes-env
<<: *common-refs
<<: *build-push-docker-image
publish-docker:
stage: publish
variables:
CI_IMAGE: $BUILDAH_IMAGE
before_script:
- if [[ "${CI_COMMIT_TAG}" ]]; then
VERSION=${CI_COMMIT_TAG};
elif [[ "${CI_COMMIT_SHORT_SHA}" ]]; then
VERSION=${CI_COMMIT_SHORT_SHA};
fi
<<: *kubernetes-env
<<: *publish-refs
<<: *build-push-docker-image
publish-docker-image-description:
stage: publish
<<: *kubernetes-env
image: paritytech/dockerhub-description
variables:
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
README_FILEPATH: $CI_PROJECT_DIR/scripts/ci/docker/Dockerfile.README.md
DOCKERHUB_REPOSITORY: $IMAGE_NAME
SHORT_DESCRIPTION: "A cli tool to easily spawn ephemeral Polkadot/Substrate networks and perform tests against them"
rules:
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- scripts/ci/docker/Dockerfile.README.md
script:
- cd / && sh entrypoint.sh
zombienet-smoke:
stage: deploy
<<: *kubernetes-env
<<: *common-refs
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
variables:
GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/smoke"
before_script:
- echo "Zombienet Smoke Tests"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export COL_IMAGE="docker.io/paritypr/colander:master"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--test="0001-smoke.zndsl"
allow_failure: false
retry: 2
tags:
- zombienet-polkadot-integration-test
zombienet-scale-net-config:
stage: deploy
<<: *kubernetes-env
<<: *common-refs
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
variables:
GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/scale-net"
before_script:
- echo "Zombienet Tests Scale Net"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export COL_IMAGE="docker.io/paritypr/colander:master"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--test="0001-scale-net.zndsl"
allow_failure: true
retry: 2
tags:
- zombienet-polkadot-integration-test
zombienet-upgrade-node:
stage: deploy
<<: *kubernetes-env
<<: *common-refs
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
variables:
GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/k8s"
before_script:
- echo "Zombienet Upgrade node"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export COL_IMAGE="docker.io/paritypr/colander:4519"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--test="0001-upgrade-node.zndsl"
allow_failure: true
retry: 2
tags:
- zombienet-polkadot-integration-test
paras:
stage: deploy
<<: *kubernetes-env
<<: *common-refs
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
variables:
GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/paras"
before_script:
- echo "Zombienet Paras smoke test"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export BIFROST_COL_IMAGE=docker.io/bifrostnetwork/bifrost:latest
- export MOONBEAM_COL_IMAGE=docker.io/purestake/moonbeam:v0.26
- export OAK_COL_IMAGE=docker.io/oaknetwork/turing:latest
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--test="paras.zndsl"
allow_failure: true
retry: 2
tags:
- zombienet-polkadot-integration-test
db-snapshot:
stage: deploy
<<: *kubernetes-env
<<: *common-refs
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
variables:
GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests"
before_script:
- echo "Zombienet Db Snapshot"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export COL_IMAGE="docker.io/paritypr/colander:master"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--test="0013-db-snapshot.zndsl"
allow_failure: true
retry: 2
tags:
- zombienet-polkadot-integration-test