forked from YottaDB/YDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
389 lines (344 loc) · 9.81 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#################################################################
# #
# Copyright (c) 2018-2024 YottaDB LLC and/or its subsidiaries. #
# All rights reserved. #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
# under a license. If you do not know the terms of #
# the license, please stop and do not read further. #
# #
#################################################################
image: docker:latest
services:
- docker:dind
variables:
DOCKER_BUILDKIT: 1
stages:
- build
- test
- docker-create
- docker-manifest
commit-verify:
image: ubuntu:22.04
stage: build
interruptible: true
before_script:
- apt-get update -qq && apt-get install -y -qq git wget gnupg
script:
- ci/commit_verify.sh ci/needs_copyright.sh https://gitlab.com/YottaDB/DB/YDB
.clang-tidy:
image: ubuntu:22.04
# NOTE: conceptually this is a test and not a build.
# However, if we make it part of the `test` stage, it will only
# run after all other builds succeed. Since it already takes a half-hour to
# execute, run it in parallel with all other build jobs instead.
stage: build
interruptible: true
artifacts:
paths:
- build/warnings/
- ci/
when: always
expire_in: 1 month
script:
- apt-get update -q
- apt-get -q install -y --no-install-recommends >/dev/null
ca-certificates
clang-14
clang-tidy-14
file
cmake
make
git
tcsh
libconfig-dev
libelf-dev
libgcrypt-dev
libgpg-error-dev
libgpgme11-dev
libicu-dev
libncurses-dev
libssl-dev
moreutils
shellcheck
zlib1g-dev
libreadline-dev
- ci/build.sh
clang-tidy-amd64:
extends: .clang-tidy
# We run this job only on master since it's slow (30 minutes)
clang-tidy-aarch64:
# Override default runner timeout of 1 hour since this job has sometimes timed out
timeout: 3h
extends: .clang-tidy
tags:
- aarch64
only:
- master@YottaDB/DB/YDB
build-test:
stage: build
script:
- mkdir -p docker-images
- docker build -f Dockerfile-test -t ydbtest .
- docker save ydbtest > docker-images/ydbtest.tar
cache:
key: "$CI_PIPELINE_ID"
paths:
- docker-images
policy: push
.test-shared:
stage: test
artifacts:
paths:
- testarea/
expire_in: 1 month
when: always
dependencies:
- build-test
cache:
key: "$CI_PIPELINE_ID"
paths:
- docker-images
policy: pull
script:
- mkdir testarea
- docker load < docker-images/ydbtest.tar
- docker run --init -t -v $PWD/testarea/:/testarea1/ -e CI_PIPELINE_ID -e CI_COMMIT_BRANCH --rm ydbtest -t ${TEST}
- docker run --init -t -v $PWD/testarea/:/testarea1/ -e CI_PIPELINE_ID -e CI_COMMIT_BRANCH --rm ydbtest -t ${TEST} -replic
test-basic:
extends: .test-shared
variables:
TEST: basic
test-r134:
extends: .test-shared
variables:
TEST: r134
test-r138:
extends: .test-shared
variables:
TEST: r138
test-r140:
extends: .test-shared
variables:
TEST: r140
test-v70001:
extends: .test-shared
variables:
TEST: v70001
# Main and ONLY docker creation mechanism.
.docker-create:
stage: docker-create
script:
- docker build --platform=${PLATFORM} ${ARGS} --pull -t yottadb/${REPO}:${DOCKERHUBTAG} -f ${DOCKERFILE} .
- docker login -u $HUB_USERNAME -p $HUB_PASSWORD
- docker push yottadb/${REPO}:${DOCKERHUBTAG}
- docker tag yottadb/${REPO}:${DOCKERHUBTAG} yottadb/${REPO}:$(grep YDB_ZYRELEASE sr_*/release_name.h | grep -o '\(r[0-9.]*\)' | grep -v '^r$' | sort -u)
- docker push yottadb/${REPO}:$(grep YDB_ZYRELEASE sr_*/release_name.h | grep -o '\(r[0-9.]*\)' | grep -v '^r$' | sort -u)
- 'echo -e "FROM yottadb/${REPO}:${DOCKERHUBTAG}\n ENTRYPOINT []" > BareDockerfile'
- docker build --platform=${PLATFORM} --pull -t yottadb/${REPO}-base:${DOCKERHUBTAG} -f BareDockerfile .
- docker push yottadb/${REPO}-base:${DOCKERHUBTAG}
- docker tag yottadb/${REPO}-base:${DOCKERHUBTAG} yottadb/${REPO}-base:$(grep YDB_ZYRELEASE sr_*/release_name.h | grep -o '\(r[0-9.]*\)' | grep -v '^r$' | sort -u)
- docker push yottadb/${REPO}-base:$(grep YDB_ZYRELEASE sr_*/release_name.h | grep -o '\(r[0-9.]*\)' | grep -v '^r$' | sort -u)
only:
- master@YottaDB/DB/YDB
.docker-manifest:
stage: docker-manifest
script:
- docker login -u $HUB_USERNAME -p $HUB_PASSWORD
- docker pull yottadb/${REPO}:${DOCKERHUBTAG}-amd64
- docker pull yottadb/${REPO}:${DOCKERHUBTAG}-aarch64
- docker manifest create yottadb/${REPO}:${DOCKERHUBTAG} yottadb/${REPO}:${DOCKERHUBTAG}-amd64 yottadb/${REPO}:${DOCKERHUBTAG}-aarch64
- docker manifest inspect yottadb/${REPO}:${DOCKERHUBTAG}
- docker manifest push yottadb/${REPO}:${DOCKERHUBTAG}
- docker pull yottadb/${REPO}-base:${DOCKERHUBTAG}-amd64
- docker pull yottadb/${REPO}-base:${DOCKERHUBTAG}-aarch64
- docker manifest create yottadb/${REPO}-base:${DOCKERHUBTAG} yottadb/${REPO}-base:${DOCKERHUBTAG}-amd64 yottadb/${REPO}-base:${DOCKERHUBTAG}-aarch64
- docker manifest inspect yottadb/${REPO}-base:${DOCKERHUBTAG}
- docker manifest push yottadb/${REPO}-base:${DOCKERHUBTAG}
tags:
- amd64
only:
- master@YottaDB/DB/YDB
# Section for creating single commit docker images (:latest-master docker tag)
# amd64
.docker-create-amd64:
extends: .docker-create
variables:
PLATFORM: linux/amd64
DOCKERHUBTAG: latest-master-amd64
tags:
- amd64
# aarch64
.docker-create-aarch64:
extends: .docker-create
variables:
PLATFORM: linux/aarch64
DOCKERHUBTAG: latest-master-aarch64
tags:
- aarch64
# END
# Section for creating Git tag Dockerfiles (:latest docker tag)
# amd64
.docker-create-amd64-release:
extends: .docker-create
variables:
PLATFORM: linux/amd64
DOCKERHUBTAG: latest-amd64
tags:
- amd64
only:
- tags
# aarch64
.docker-create-aarch64-release:
extends: .docker-create
variables:
PLATFORM: linux/aarch64
DOCKERHUBTAG: latest-aarch64
tags:
- aarch64
only:
- tags
# END
# Shared Section for manifests
.docker-manifest-commit:
stage: docker-manifest
extends: .docker-manifest
variables:
DOCKERHUBTAG: latest-master
.docker-manifest-release:
stage: docker-manifest
extends: .docker-manifest
variables:
DOCKERHUBTAG: latest
only:
- tags
# END
# Single commit docker images for amd64 (:latest-master)
docker-create-ubuntu-amd64:
extends: .docker-create-amd64
variables:
DOCKERFILE: Dockerfile
REPO: yottadb
docker-create-ubuntu-debug-amd64:
extends: .docker-create-amd64
variables:
DOCKERFILE: Dockerfile
REPO: yottadb-debug
ARGS: --build-arg CMAKE_BUILD_TYPE=Debug
docker-create-rocky-amd64:
extends: .docker-create-amd64
variables:
DOCKERFILE: Dockerfile-rocky
REPO: yottadb-rocky
docker-create-debian-amd64:
extends: .docker-create-amd64
variables:
DOCKERFILE: Dockerfile-debian
REPO: yottadb-debian
# END
# Single commit docker images for aarch64 (:latest-master)
docker-create-ubuntu-aarch64:
extends: .docker-create-aarch64
variables:
DOCKERFILE: Dockerfile
REPO: yottadb
docker-create-ubuntu-debug-aarch64:
extends: .docker-create-aarch64
variables:
DOCKERFILE: Dockerfile
REPO: yottadb-debug
ARGS: --build-arg CMAKE_BUILD_TYPE=Debug
docker-create-rocky-aarch64:
extends: .docker-create-aarch64
variables:
DOCKERFILE: Dockerfile-rocky
REPO: yottadb-rocky
docker-create-debian-aarch64:
extends: .docker-create-aarch64
variables:
DOCKERFILE: Dockerfile-debian
REPO: yottadb-debian
# END
# Single Commit Manifests (:latest-master)
docker-manifest-ubuntu:
extends: .docker-manifest-commit
variables:
REPO: yottadb
docker-manifest-ubuntu-debug:
extends: .docker-manifest-commit
variables:
REPO: yottadb-debug
docker-manifest-rocky:
extends: .docker-manifest-commit
variables:
REPO: yottadb-rocky
docker-manifest-debian:
extends: .docker-manifest-commit
variables:
REPO: yottadb-debian
# END
# Git Tag commit docker images for amd64 (:latest)
docker-create-release-ubuntu-amd64:
extends: .docker-create-amd64-release
variables:
DOCKERFILE: Dockerfile
REPO: yottadb
docker-create-release-ubuntu-debug-amd64:
extends: .docker-create-amd64-release
variables:
DOCKERFILE: Dockerfile
REPO: yottadb-debug
ARGS: --build-arg CMAKE_BUILD_TYPE=Debug
docker-create-release-rocky-amd64:
extends: .docker-create-amd64-release
variables:
DOCKERFILE: Dockerfile-rocky
REPO: yottadb-rocky
docker-create-release-debian-amd64:
extends: .docker-create-amd64-release
variables:
DOCKERFILE: Dockerfile-debian
REPO: yottadb-debian
# END
# Git Tag commit docker images for aarch64 (:latest)
docker-create-release-ubuntu-aarch64:
extends: .docker-create-aarch64-release
variables:
DOCKERFILE: Dockerfile
REPO: yottadb
docker-create-release-ubuntu-debug-aarch64:
extends: .docker-create-aarch64-release
variables:
DOCKERFILE: Dockerfile
REPO: yottadb-debug
ARGS: --build-arg CMAKE_BUILD_TYPE=Debug
docker-create-release-rocky-aarch64:
extends: .docker-create-aarch64-release
variables:
DOCKERFILE: Dockerfile-rocky
REPO: yottadb-rocky
docker-create-release-debian-aarch64:
extends: .docker-create-aarch64-release
variables:
DOCKERFILE: Dockerfile-debian
REPO: yottadb-debian
#END
# Git Tag commit manifests (:latest)
docker-manifest-ubuntu-release:
extends: .docker-manifest-release
variables:
REPO: yottadb
docker-manifest-ubuntu-debug-release:
extends: .docker-manifest-release
variables:
REPO: yottadb-debug
docker-manifest-rocky-release:
extends: .docker-manifest-release
variables:
REPO: yottadb-rocky
docker-manifest-debian-release:
extends: .docker-manifest-release
variables:
REPO: yottadb-debian
# END