-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
423 lines (392 loc) · 15.1 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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
stages:
- build:srpm
- build:rpm
- analysis:check
- analysis:report
- build:dockerimage
- test
- regressions
- shouldfail
- publish_rpm
- release_rpm
- docs
variables:
XROOTD_VERSION: 4
SCHED_TYPE: "objectstore"
SCHED_OPT: ""
SCHED_VERSION: ""
before_script:
- export CTA_BUILD_ID=${CI_PIPELINE_ID}git${CI_COMMIT_SHA:0:8}
- echo "Exporting CTA_BUILD_ID=${CTA_BUILD_ID}"
- test -n "${CI_COMMIT_TAG}" && export TAG_VERSION=$(echo ${CI_COMMIT_TAG} | sed -e 's/^v//;s/-.*$//')
- test -n "${CI_COMMIT_TAG}" && export TAG_RELEASE=$(echo ${CI_COMMIT_TAG} | sed -e 's/^[^-]*-//')
- major_version=$(echo ${TAG_VERSION} | cut -d. -f1)
- if [[ ${major_version} == 5 ]];
then echo "Setting to compile with XRootD version 5";
XROOTD_VERSION=5;
fi
- if [[ ${XROOTD_VERSION} -eq 5 ]];
then echo "Using XRootD version 5";
sed -i 's/define xrootdVersion 1:4.12.4-1/define xrootdVersion 1:5.4.2-1/' cta.spec.in;
cp continuousintegration/docker/ctafrontend/cc7/cta-ci-xrootd5-enabled.repo continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/cta-ci.repo;
cp -f continuousintegration/docker/ctafrontend/cc7/versionlock-xrootd5.list continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list;
else echo "Using XRootD version 4";
fi
- if [ "${SCHED_TYPE}" = "objectstore" ]; then
SCHED_TYPE="";
else
echo "Using specified scheduler database type $SCHED_TYPE";
SCHED_OPT="-DCTA_USE_$(echo ${SCHED_TYPE} | tr '[:lower:]' '[:upper:]'):Bool=true";
SCHED_VERSION=$(echo ${SCHED_TYPE} | cut -c 1-3);
fi
cta_srpm:
stage: build:srpm
retry: 1
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- yum install -y devtoolset-8 cmake3 make rpm-build
- source /opt/rh/devtoolset-8/enable
- mkdir build_srpm
- cd build_srpm
- CTA_VERSION=${XROOTD_VERSION}${SCHED_VERSION} cmake3 -DPackageOnly:Bool=true -DVCS_VERSION=${CTA_BUILD_ID} ${SCHED_OPT} ..
- make cta_srpm
artifacts:
expire_in: 30 days
paths:
- build_srpm/RPM/SRPMS/
tags:
- docker
cta_rpm:
except:
- tags
stage: build:rpm
retry: 1
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/*.repo /etc/yum.repos.d/
- yum install -y devtoolset-8 cmake3 make rpm-build
- yum -y install yum-plugin-priorities yum-plugin-versionlock
- yum install -y git
- source /opt/rh/devtoolset-8/enable
- git submodule update --init --recursive
- cd xrootd-ssi-protobuf-interface && export XROOTD_SSI_PROTOBUF_INTERFACE_VERSION=$(git describe --tags --abbrev=0) && cd ..
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
- yum-builddep --nogpgcheck -y build_srpm/RPM/SRPMS/*
- mkdir build_rpm
- cd build_rpm
- if [ "${SCHED_TYPE}" = "pgsched" ]; then
echo "Skipping unit tests during cta_rpm because failed tests are expected with the development version of pgsched";
CTA_VERSION=${XROOTD_VERSION}${SCHED_VERSION} cmake3 -DVCS_VERSION=${CTA_BUILD_ID} -DSKIP_UNIT_TESTS:STRING=1 ${SCHED_OPT} ..;
else
CTA_VERSION=${XROOTD_VERSION}${SCHED_VERSION} cmake3 -DVCS_VERSION=${CTA_BUILD_ID} ${SCHED_OPT} ..;
fi;
- make cta_rpm
artifacts:
expire_in: 30 days
paths:
- build_rpm/RPM/RPMS
tags:
- docker
cta_tagged_rpm:
only:
- tags
stage: build:rpm
retry: 1
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- if [ -z "${CI_COMMIT_TAG}" ]; then echo "This is not a tagged commit, exiting"; exit 0; fi
- echo "Building package for tag ${CI_COMMIT_TAG}. CTA_VERSION=${TAG_VERSION} - CTA_RELEASE=${TAG_RELEASE}"
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/*.repo /etc/yum.repos.d/
- yum install -y devtoolset-8 cmake3 make rpm-build
- yum -y install yum-plugin-priorities yum-plugin-versionlock
- yum install -y git
- source /opt/rh/devtoolset-8/enable
- git submodule update --init --recursive
- cd xrootd-ssi-protobuf-interface && export XROOTD_SSI_PROTOBUF_INTERFACE_VERSION=$(git describe --tags --abbrev=0) && cd ..
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
- yum-builddep --nogpgcheck -y build_srpm/RPM/SRPMS/*
- mkdir build_tagged_rpm
- cd build_tagged_rpm
- CTA_VERSION=${TAG_VERSION} cmake3 -DVCS_VERSION=${TAG_RELEASE} ${SCHED_OPT} ..
- make cta_rpm
artifacts:
expire_in: 30 days
paths:
- build_tagged_rpm/RPM/RPMS
tags:
- docker
publish_tagged_rpm:
stage: publish_rpm
only:
- tags
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- if [ -z "${CI_COMMIT_TAG}" ]; then echo "This is not a tagged commit, exiting"; exit 0; fi
- EOS_ACCOUNT_USERNAME=${DOCKER_LOGIN_USERNAME} EOS_ACCOUNT_PASSWORD=${DOCKER_LOGIN_PASSWORD} CI_OUTPUT_DIR=build_tagged_rpm/RPM/RPMS EOS_PATH=/eos/user/c/ctareg/www/cta-repo HOOK=/eos/user/c/ctareg/www/cta-repo/update_repos.sh continuousintegration/ci_helpers/deploy-eos.sh
tags:
- docker
release_public_rpm:
stage: release_rpm
rules:
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- EOS_ACCOUNT_USERNAME=${DOCKER_LOGIN_USERNAME} EOS_ACCOUNT_PASSWORD=${DOCKER_LOGIN_PASSWORD} CI_OUTPUT_DIR='build_tagged_rpm/RPM/RPMS/x86_64' EOS_PATH='/eos/user/c/ctareg/www/public/cta-public-repo/7' HOOK='/eos/user/c/ctareg/www/public/update_repos.sh' continuousintegration/ci_helpers/deploy-eos.sh
tags:
- docker
cta_valgrind:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "push"
when: manual
allow_failure: true
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
allow_failure: false
variables:
CTAREPODIR: /tmp/repo
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/* /etc/yum.repos.d/
- yum -y install yum-plugin-priorities createrepo
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
- mkdir -p ${CTAREPODIR}; cp -r build_rpm/RPM ${CTAREPODIR}
- createrepo ${CTAREPODIR}; echo -e "[cta-artifacts]\nname=CTA artifacts\nbaseurl=file://${CTAREPODIR}\ngpgcheck=0\nenabled=1\npriority=2" > /etc/yum.repos.d/cta-artifacts.repo
- yum -y --nogpgcheck install cta-systemtests cta-debuginfo sqlite-debuginfo --enablerepo=debug
- /usr/bin/cta-unitPlusSystemTests.sh
tags:
- docker
dbunittests_postgresql:
except:
- tags
stage: test
variables:
CTAREPODIR: /tmp/repo
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/* /etc/yum.repos.d/
- yum -y install yum-plugin-priorities createrepo
- cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
- mkdir -p ${CTAREPODIR}; cp -r build_rpm/RPM ${CTAREPODIR}
- createrepo ${CTAREPODIR}; echo -e "[cta-artifacts]\nname=CTA artifacts\nbaseurl=file://${CTAREPODIR}\ngpgcheck=0\nenabled=1\npriority=2" > /etc/yum.repos.d/cta-artifacts.repo
- yum -y --nogpgcheck install cta-systemtests cta-debuginfo sqlite-debuginfo --enablerepo=debug
- yum -y install cta-catalogueutils
- yum -y install rh-postgresql12-postgresql-server
- POSTGRESQL_DATA_DIR=/usr/local/cta_test_pgsql_data
- POSTGRESQL_LOG_DIR=/var/log/postgres
- echo POSTGRESQL_DATA_DIR=${POSTGRESQL_DATA_DIR}
- echo POSTGRESQL_LOG_DIR=${POSTGRESQL_LOG_DIR}
- mkdir -p ${POSTGRESQL_DATA_DIR}
- chown -R postgres:postgres ${POSTGRESQL_DATA_DIR}
- mkdir -p ${POSTGRESQL_LOG_DIR}
- chown -R postgres:postgres ${POSTGRESQL_LOG_DIR}
- export LD_LIBRARY_PATH=/opt/rh/rh-postgresql12/root/usr/lib64
- POSTGRES_BIN=/opt/rh/rh-postgresql12/root/usr/bin
- echo POSTGRES_BIN=${POSTGRES_BIN}
- runuser -u postgres -- ${POSTGRES_BIN}/initdb -D ${POSTGRESQL_DATA_DIR}
- runuser -u postgres -- ${POSTGRES_BIN}/pg_ctl start -w -t 10 -D ${POSTGRESQL_DATA_DIR} -l ${POSTGRESQL_LOG_DIR}/cta_test_postgres.log
- runuser -u postgres -- ${POSTGRES_BIN}/createdb cta
- runuser -u postgres -- ${POSTGRES_BIN}/createuser -E cta
- CTA_CATALOGUE_CONF=/etc/cta/cta-catalogue.conf
- echo CTA_CATALOGUE_CONF=${CTA_CATALOGUE_CONF}
- echo 'postgresql:postgresql://cta@localhost/cta' > ${CTA_CATALOGUE_CONF}
- /usr/bin/cta-catalogue-schema-create ${CTA_CATALOGUE_CONF}
- /usr/bin/cta-rdbmsUnitTests ${CTA_CATALOGUE_CONF}
- valgrind /usr/bin/cta-rdbmsUnitTests ${CTA_CATALOGUE_CONF}
- runuser -u postgres -- ${POSTGRES_BIN}/pg_ctl stop -D ${POSTGRESQL_DATA_DIR}
tags:
- docker
ctageneric_docker:
except:
- tags
stage: build:dockerimage
image:
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
entrypoint: [""]
retry: 1
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"${DOCKER_LOGIN_USERNAME}\",\"password\":\"${DOCKER_LOGIN_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $DOCKERFILE --destination ${CI_REGISTRY}/cta/ctageneric:${CTA_BUILD_ID}
variables:
DOCKERFILE: continuousintegration/docker/ctafrontend/cc7/ci_runner/Dockerfile
archiveretrieve:
except:
- tags
stage: test
script:
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/archive_retrieve.sh -O -D -t 2400 -C
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
archiveretrieve-eos5:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "push"
when: manual
allow_failure: true
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
allow_failure: false
script:
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/archive_retrieve.sh -O -D -t 2400 -C -e eos5-config-quarkdb.yaml
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
repack:
except:
- tags
stage: test
script:
- export NAMESPACE="repack-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/repack_systemtest_wrapper.sh -O -D -t 2400 -C
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
repack-eos5:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "push"
when: manual
allow_failure: true
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
allow_failure: false
script:
- export NAMESPACE="repack-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/repack_systemtest_wrapper.sh -O -D -t 2400 -C -e eos5-config-quarkdb.yaml
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
dbunittests_oracle:
except:
- tags
stage: test
script:
- export NAMESPACE="dbunittestsoracle-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s /usr/bin/true -O -D -U -t 600 -C
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
nightly1:
stage: shouldfail
only:
- triggers
script:
- echo "Running nightly tests"
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/test_nightly1.sh -O -D
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
- xlarge
regressioneos:
stage: regressions
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
allow_failure: true
script:
- echo "Running nightly eos regression tests"
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/upgrade-eos.sh -O -D -S
artifacts:
when: always
expire_in: 30 days
paths:
- pod_logs
tags:
- kubernetes
- mhvtl
- xlarge
catalogue_schema_draw:
stage: test
image: gitlab-registry.cern.ch/cta/eoscta-operations/registry/container_registry/cta-schemacrawler
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
changes:
- catalogue/common_catalogue_schema.sql
when: on_success
allow_failure: true
script:
- echo "Generating DB schema drawing"
- mkdir drawings
- sqlite3 common_db.sqlite < catalogue/common_catalogue_schema.sql
- /opt/schemacrawler/bin/schemacrawler.sh --server=sqlite --database=common_db.sqlite --command=script --script-language=python --script=/opt/mermaid.py --info-level=standard > drawings/db_schema.mmd
- /opt/schemacrawler/bin/schemacrawler.sh --server=sqlite --database=common_db.sqlite --command=schema --outputformat=png --info-level=standard --output-file=drawings/db_schema.png
- /opt/schemacrawler/bin/schemacrawler.sh --server=sqlite --database=common_db.sqlite --command=schema --outputformat=svg --info-level=standard --output-file=drawings/db_schema.svg
artifacts:
when: always
expire_in: 30 days # Pipeline artifacts from the latest pipeline are kept forever.
paths:
- drawings/
trigger_doc_update:
stage: docs
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
changes:
- catalogue/common_catalogue_schema.sql
when: manual
allow_failure: true
trigger:
project: CTA/eoscta-docs
strategy: depend
cppcheck:
except:
- tags
stage: analysis:check
image:
name: neszt/cppcheck-docker
entrypoint: ["/usr/bin/env"]
script:
- cppcheck --xml --force --enable=warning,performance --inline-suppr --suppressions-list=.cppcheck-suppressions.txt . 2> cppcheck_out.xml
artifacts:
expire_in: 2 days
paths:
- cppcheck_out.xml
# based on https://gitlab.com/ahogen/cppcheck-codequality
cppcheck_report:
except:
- tags
stage: analysis:report
image: centos:7
script:
- yum -y install python3-pip
- python3 -m pip install -U cppcheck_codequality
- cppcheck-codequality --input-file=cppcheck_out.xml --output-file=cppcheck.json
- if cat cppcheck_out.xml | grep -q "\"error\""; then echo "ERRORS have been detected"; exit 1; fi;
artifacts:
reports:
codequality: cppcheck.json