-
Notifications
You must be signed in to change notification settings - Fork 91
/
.gitlab-ci.yml
291 lines (264 loc) · 8.33 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
default:
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
interruptible: true
stages:
- build
- test
- check
- publish
- zombienet
variables:
CI_IMAGE: "node:18"
DOCKERFILE: scripts/ci/docker/zombienet_injected.Dockerfile
DOCKERHUB_REPO: paritytech
IMAGE_NAME: $DOCKERHUB_REPO/zombienet
# BUILDAH_IMAGE is defined in group variables
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
RUN_IN_CONTAINER: "1"
# Improve gitlab cache performance
CACHE_COMPRESSION_LEVEL: "fastest"
FF_USE_FASTZIP: "true"
PUSHGATEWAY_URL: "http://zombienet-prometheus-pushgateway.managed-monitoring:9091/metrics/job/zombie-metrics"
DEBUG: "zombie,zombie::network-node,zombie::kube::client::logs"
cache:
- key:
files:
- javascript/package-lock.json
- paths:
- javascript/packages/cli/dist
- javascript/packages/orchestrator/dist
- javascript/packages/utils/dist
- javascript/package.json
- javascript/package-lock.json
.kubernetes-env: &kubernetes-env
image: $CI_IMAGE
tags:
- kubernetes-parity-build
# run jobs only on PRs with changes in code.
.test-refs: &test-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- changes:
- javascript/**/*
- tests/**/*
- crates/**/*
# 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
test:
stage: test
<<: *kubernetes-env
<<: *common-refs
script:
- cd javascript
- npm install
# - npm run test
- echo testme
build:
stage: build
<<: *kubernetes-env
<<: *common-refs
script:
- cd javascript
- npm install
- npm run clean
- npm run build
# 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-common:
before_script:
- echo "Zombienet Tests Config"
- echo "${ZOMBIENET_IMAGE}"
- echo "${GH_DIR}"
- echo "${LOCAL_DIR}"
- export DEBUG=zombie
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export COL_IMAGE="docker.io/paritypr/colander:master"
# TODO: add script to get latest from dockerhub
- export CUMULUS_TEST_IMAGE="docker.io/paritypr/test-parachain:c90f9713b5bc73a9620b2e72b226b4d11e018190"
- echo "relay_image ${ZOMBIENET_INTEGRATION_TEST_IMAGE}"
- echo "col_image ${COL_IMAGE}"
stage: zombienet
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
needs:
- job: publish-docker-pr
extends:
- .kubernetes-env
- .test-refs
variables:
LOCAL_DIR: "/builds/parity/mirrors/zombienet/tests"
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: always
expire_in: 2 days
paths:
- ./zombienet-logs
after_script:
- mkdir -p ./zombienet-logs
- cp /tmp/zombie*/logs/* ./zombienet-logs/
retry: 2
tags:
- zombienet-polkadot-integration-test
zombienet-smoke:
extends:
- .zombienet-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}"
--test="0001-smoke.zndsl"
zombienet-scale-net-config:
extends:
- .zombienet-common
variables:
LOCAL_DIR: "/builds/parity/mirrors/zombienet/tests/scale-net"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}"
--test="0001-scale-net.zndsl"
zombienet-upgrade-node:
extends:
- .zombienet-common
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"
- echo "relay_image ${ZOMBIENET_INTEGRATION_TEST_IMAGE}"
- echo "col_image ${COL_IMAGE}"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}"
--test="0001-upgrade-node.zndsl"
# paras:
# extends:
# - .zombienet-common
# 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
# --local-dir="${LOCAL_DIR}"
# --test="paras.zndsl"
# db-snapshot:
# extends:
# - .zombienet-common
# script:
# - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
# --local-dir="${LOCAL_DIR}"
# --test="0013-db-snapshot.zndsl"
chaos-delay:
extends:
- .zombienet-common
variables:
LOCAL_DIR: "/builds/parity/mirrors/zombienet/tests/chaos"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}"
--test="0001-delay.zndsl"