This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
339 lines (313 loc) · 10.5 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
variables:
EOS_PATH: "/eos/project/d/diracos/www/"
stages:
- changelog
- compile
- links
- test
- deploy
- push
changelog:
stage: changelog
tags:
- docker
image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7
except:
- tags
before_script:
- pip install 'setuptools<45'
- pip install --upgrade 'pip<21'
- pip install -U python-dateutil pytz
script:
- echo "GITHUBTOKEN = \"$GITHUBTOKEN\"" >& GitTokens.py
- export PYTHONPATH=$(pwd)
- mkdir changes
- curl -O https://raw.githubusercontent.com/DIRACGrid/DIRAC/rel-v7r3/docs/diracdoctools/scripts/dirac-docs-get-release-notes.py
- python dirac-docs-get-release-notes.py --sinceLatestTag -r DIRACGrid/DIRACOS --branches master > changes/PRs.txt
- sed -i '1,1d' changes/PRs.txt
- sort -o changes/PRs.txt changes/PRs.txt
- cat changes/PRs.txt | cat - release.notes > temp
- source ./docs/Tools/CreateName.sh
- echo "[${BUILD_NAME}]" | cat - temp > changes/release.notes
artifacts:
paths:
- changes
compile:
stage: compile
dependencies:
- changelog
retry: 2
tags:
- DIRACOS
except:
- tags
image: diracgrid/centos6
script:
- source ./docs/Tools/CreateName.sh
- sed -i "2s/master/${BUILD_NAME}/" config/diracos.json
- cp config/diracos.json changes/diracos.json
- export DIRACOS_REPO=/diracos_repo
- mkdir -p $DIRACOS_REPO/i386 $DIRACOS_REPO/i686 $DIRACOS_REPO/src $DIRACOS_REPO/noarch $DIRACOS_REPO/x86_64 $DIRACOS_REPO/bootstrap $DIRACOS_REPO/buildOnly
- curl -o $DIRACOS_REPO/bootstrap/lbzip2-2.5-2.el6.x86_64.rpm -L https://diracos.web.cern.ch/diracos/bootstrap/lbzip2-2.5-2.el6.x86_64.rpm
- curl -o $DIRACOS_REPO/bootstrap/pigz-2.3.4-1.el6.x86_64.rpm -L https://diracos.web.cern.ch/diracos/bootstrap/pigz-2.3.4-1.el6.x86_64.rpm
- createrepo $DIRACOS_REPO
- pip install git+${CI_REPOSITORY_URL}@${CI_COMMIT_REF_NAME}
- sed -i -e 's/-j4/-j16/g' mockConfigs/mock-build-diracos.cfg
- dos-build-all-rpms config/diracos.json
- dos-fix-pip-versions config/diracos.json
- mkdir -p public/releases
- mkdir -p public/RPMs
- if [[ "${CI_COMMIT_REF_NAME}" == "master" ]]; then cp /var/lib/mock/epel-6-x86_64-install/root/tmp/fixed_requirements.txt public/releases/requirements_master.txt ; fi
- cp /var/lib/mock/epel-6-x86_64-install/root/tmp/fixed_requirements.txt changes/requirements.txt
- cp /var/lib/mock/epel-6-x86_64-install/root/tmp/fixed_requirements.txt config/requirements.txt
- dos-build-python-modules config/diracos.json
- dos-bundle config/diracos.json
- cp /var/lib/mock/epel-6-x86_64-install/root/tmp/diracos-${BUILD_NAME}.tar.gz public/releases/diracos-${BUILD_NAME}.tar.gz
- cd public/releases
- md5sum diracos-${BUILD_NAME}.tar.gz | awk {'print $1'} > diracos-${BUILD_NAME}.md5
- cd ../..
- tar -zcf public/RPMs/diracos-${BUILD_NAME}-RPMs.tar.gz /diracos_repo
- cd public/RPMs/
- md5sum diracos-${BUILD_NAME}-RPMs.tar.gz | awk {'print $1'} > diracos-${BUILD_NAME}-RPMs.md5
artifacts:
paths:
- public
- changes
expire_in: 1 week
# Check links
check_links:
stage: links
dependencies:
- compile
tags:
- docker
except:
- tags
image: diracgrid/centos6
before_script:
- yum install tar -y
script:
- source ./docs/Tools/CreateName.sh
- tar xf public/releases/diracos-${BUILD_NAME}.tar.gz -C /tmp
- export DIRACOS=/tmp/diracos
- source $DIRACOS/diracosrc
- ./tests/integration/test_symlink.sh
# Check dependencies
check_dependencies:
stage: links
dependencies:
- compile
tags:
- docker
except:
- tags
image: diracgrid/centos6
before_script:
- yum install tar -y
script:
- source ./docs/Tools/CreateName.sh
- tar xf public/releases/diracos-${BUILD_NAME}.tar.gz -C /tmp
- export DIRACOS=/tmp/diracos
- source $DIRACOS/diracosrc
- ./tests/integration/test_ldd.sh
# Run tests
.run_test:
stage: test
dependencies:
- compile
tags:
- docker
except:
- tags
script:
- source ./docs/Tools/CreateName.sh
- tar xf public/releases/diracos-${BUILD_NAME}.tar.gz -C /tmp
- export DIRACOS=/tmp/diracos
- source $DIRACOS/diracosrc
- pytest tests/integration/test_import.py
- tests/integration/test_cli.sh
SLC6:
extends: .run_test
image: diracgrid/centos6
before_script:
# graphical libraries needed for rrdtool
- yum install -y tar freetype fontconfig pixman libXrender
CC7:
extends: .run_test
image: cern/cc7-base
before_script:
# graphical libraries needed for rrdtool
- yum install -y freetype fontconfig pixman libXrender
CC8:
extends: .run_test
image: centos:8
allow_failure: true
before_script:
# graphical libraries needed for rrdtool
- yum install -y freetype fontconfig pixman libXrender
fedora-latest:
extends: .run_test
image: fedora:latest
allow_failure: true
before_script:
# libnsl libxcrypt-compat: needed for ARC
# compat-openssl10: needed for ssh
- yum install -y libnsl libxcrypt-compat compat-openssl10
# trick for ssh to work, with compat-openssl10
# https://bugzilla.redhat.com/show_bug.cgi?id=1694850
- export OPENSSL_CONF=/etc/pki/openssl10.cnf
ubuntu-latest:
extends: .run_test
image: ubuntu:latest
allow_failure: true
.integration_tests:
stage: test
except:
- tags
dependencies:
- compile
tags:
- DIRACOS
image: alpine:edge
before_script:
# Install dependencies
- apk add docker py3-pip python3 bash git docker-compose
# Prepare docker in docker
- unset DOCKER_HOST
- mkdir -p $PWD/docker-data /var/lib
- ln -s $PWD/docker-data /var/lib/docker
- apk add --no-cache btrfs-progs e2fsprogs e2fsprogs-extra iptables openssl shadow-uidmap xfsprogs xz pigz
- dockerd >/dev/null 2>&1 &
- sleep 10
# Do the other preparations
- source ./docs/Tools/CreateName.sh
- pip3 install typer pyyaml gitpython
- git clone https://github.com/DIRACGrid/DIRAC.git -b "${DIRAC_RELEASE}"
- cd DIRAC
script:
- |
python3 ./integration_tests.py create \
HOST_OS=${HOST_OS} \
MYSQL_VER=${MYSQL_VER} \
DIRACOS_TARBALL_PATH="${CI_PROJECT_DIR}/public/releases/diracos-${BUILD_NAME}.tar.gz"
integration_tests_slc6:
extends: .integration_tests
variables:
MYSQL_VER: "mysql:5.7"
HOST_OS: slc6
DIRAC_RELEASE: rel-v7r3
integration_tests_cc7:
extends: .integration_tests
variables:
MYSQL_VER: "mysql:5.7"
HOST_OS: cc7
DIRAC_RELEASE: rel-v7r3
# integration_tests_c8:
# extends: .integration_tests
# allow_failure: true
# variables:
# MYSQL_VER: "5.7"
# HOST_OS: c8
# DIRAC_RELEASE: master
########### CHRIS
# Run the dyn tests as a separate test for the time being, so to allow it to fail
# later on, merge it with .run_test
# Download the rel-v7r3 code of DIRAC, and dynamically check the dependencies
.run_dyn_test:
stage: test
dependencies:
- compile
tags:
- docker
except:
- tags
script:
- curl --output /tmp/rel-v7r3.zip -L https://github.com/DIRACGrid/DIRAC/archive/rel-v7r3.zip
- unzip -d /tmp/ /tmp/rel-v7r3.zip
- source ./docs/Tools/CreateName.sh
- tar xf public/releases/diracos-${BUILD_NAME}.tar.gz -C /tmp
- export DIRACOS=/tmp/diracos
- source $DIRACOS/diracosrc
- pip install findimports
- DIRAC=/tmp/DIRAC-rel-v7r3/ pytest tests/integration/test_dyn_import.py
dyn_SLC6:
extends: .run_dyn_test
image: diracgrid/centos6
before_script:
# graphical libraries needed for rrdtool
- yum install -y tar freetype fontconfig pixman libXrender unzip
dyn_CC7:
extends: .run_dyn_test
image: cern/cc7-base
before_script:
# graphical libraries needed for rrdtool
- yum install -y freetype fontconfig pixman libXrender unzip
#######################################################################################
# Deploy to EOS folder
deployment:
stage: deploy
dependencies:
- compile
only:
- branches@CLICdp/iLCDirac/DIRACOS
# Custom docker image providing the needed tools to deploy in EOS
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
- deploy-eos
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []
# Update release notes and tag
push_tag:
stage: push
dependencies:
- changelog
- compile
only:
- branches@CLICdp/iLCDirac/DIRACOS
tags:
- docker
variables:
GIT_STRATEGY: none
image: cern/cc7-base
before_script:
- curl -O -L https://diracos.web.cern.ch/diracos/bootstrap/get-pip.py
- python get-pip.py pip==20.2.4
- pip install -U requests python-dateutil pytz
- yum install git less -y
- eval `ssh-agent -s`
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KEY" | tr -d '\r' > /root/.ssh/id_rsa
- chmod 700 /root/.ssh/id_rsa
- ssh-keyscan -H github.com >> /root/.ssh/known_hosts
- git config --global user.email "[email protected]"
- git config --global user.name "DIRACOS"
- git config --global pull.rebase true
script:
- git clone [email protected]:DIRACGrid/DIRACOS.git DIRACOS
- cd DIRACOS
- source ./docs/Tools/CreateName.sh
- mkdir bundle
- tar xf ../public/releases/diracos-${BUILD_NAME}.tar.gz -C bundle
- git pull origin master
- cp ../changes/release.notes release.notes
- git add release.notes
- git commit -m"Add release notes for ${BUILD_NAME}"
- if $MAKE_TAG ; then git push origin master ; fi
- cp ../changes/requirements.txt config/requirements.txt
- cp ../changes/diracos.json config/diracos.json
- git add config/requirements.txt
- git add config/diracos.json
- git commit -m"Update requirements.txt and diracos.json for release ${BUILD_NAME}"
- git tag -a ${BUILD_NAME} -m "${BUILD_NAME}"
- if $MAKE_TAG ; then git push origin --tags ; fi
- echo "GITHUBTOKEN = \"$GITHUBTOKEN\"" >& GitTokens.py
- export PYTHONPATH=$(pwd)
- echo $'## This release contains the following PRs \n' > releaseText.txt
- cat ../changes/PRs.txt >> releaseText.txt
- echo $'## Included versions of packages \n\n' >> releaseText.txt
- cat bundle/diracos/versions.txt >> releaseText.txt
- cat releaseText.txt
- curl -O https://raw.githubusercontent.com/DIRACGrid/DIRAC/rel-v7r3/docs/diracdoctools/scripts/dirac-docs-get-release-notes.py
- if $MAKE_TAG ; then python dirac-docs-get-release-notes.py -r DIRACGrid/DIRACOS --tagName ${BUILD_NAME} --releaseNotes releaseText.txt --deployRelease ; fi