forked from LCDsoft/ILCDIRAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
501 lines (448 loc) · 12.4 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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
before_script:
- echo $LCG_BUNDLE_VERSION $ILCDIRAC_VERSION $DIRAC_BRANCH $SETUP
- source /cvmfs/clicdp.cern.ch/software/git/2.13.2/x86_64-slc6-gcc7-opt/setup.sh
- shopt -s extglob
stages:
- install
- unittest
- integration
- create
- deploy
- deployToCVMFS
variables:
LCG_BUNDLE_VERSION: "v14r3"
ILCDIRAC_VERSION: "v29r2"
DIRAC_BRANCH: "rel-v6r22"
DIRAC_TAG: "v6r22p18"
SETUP: "ILC-Production"
ILCDIRAC_BRANCH: "Rel-v29r2"
DIRAC_DEPRECATED_FAIL: "1"
.retry_template: &retry_policy
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- unknown_failure
- api_failure
- runner_unsupported
.install_template: &install
stage: install
script:
- cd ../
- rm -rf !(ILCDIRAC) .installCache
- mv ILCDIRAC ILCDIRAC_commit
- mkdir ILCDIRAC; cd ILCDIRAC
- mkdir installation; cd installation
- wget -O dirac-install -np https://raw.github.com/DIRACGrid/DIRAC/integration/Core/scripts/dirac-install.py --no-check-certificate
- chmod +x dirac-install
- ./dirac-install -V ILCDIRAC -r $ILCDIRAC_VERSION -g $LCG_BUNDLE_VERSION
- rm -rf DIRAC
- git clone https://github.com/DIRACGrid/DIRAC.git --depth 1 --single-branch -b $DIRAC_BRANCH DIRAC
- rm -rf ILCDIRAC
- mv ../../ILCDIRAC_commit ILCDIRAC
- rm -rf .installCache
- source bashrc
- dirac-deploy-scripts
- unset REQUESTS_CA_BUNDLE
- pip install --upgrade pip
- pip uninstall -y distribute
- pip install --upgrade setuptools || echo "done"
- pip install --upgrade setuptools_scm || echo "done scm"
- pip install --upgrade pylint mock MySQL-python pytest-cov pytest-randomly pytest-mock pytest-timeout pytest-xdist flake8 psutil flake8-docstrings flake8-commas caniusepython3 parameterized
- cd ..
artifacts:
paths:
- installation
expire_in: 2 hours
<<: *retry_policy
.sl6docker_template: &sl6docker
tags:
- docker
image: gitlab-registry.cern.ch/clicdp/ilcdirac/ilcdirac-ci-images:slc6
.cc7docker_template: &cc7docker
tags:
- docker
image: gitlab-registry.cern.ch/clicdp/ilcdirac/ilcdirac-ci-images:cc7
install:SL6:
<<: *install
<<: *sl6docker
install:CC7:
<<: *install
<<: *cc7docker
except:
- tags
code_quality:
stage: integration
except:
- tags
tags:
- overlay
image: docker:stable
variables:
DOCKER_DRIVER: overlay
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [gl-code-quality-report.json]
allow_failure: true
before_script: []
after_script: []
dependencies: []
<<: *retry_policy
.unittest_template: &unittest
stage: unittest
variables:
GIT_STRATEGY: none
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- unset PYTHONOPTIMIZE
- .gitlab-ci.d/run-unittests.sh
coverage: '/\d+\%\s*$/'
artifacts:
paths:
- installation/ILCDIRAC/.coverage
- installation/ILCDIRAC/htmlcov
reports:
junit: installation/ILCDIRAC/junit_unit.xml
expire_in: 2 hours
<<: *retry_policy
except:
- tags
unittest:SL6:
<<: *unittest
<<: *sl6docker
needs: ["install:SL6"]
unittest:CC7:
<<: *unittest
<<: *cc7docker
needs: ["install:CC7"]
checkFormat:
<<: *sl6docker
allow_failure: true
<<: *retry_policy
stage: unittest
needs: ["install:SL6"]
except:
- tags
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- git remote add CLICDP https://gitlab.cern.ch/CLICdp/iLCDirac/ILCDIRAC.git
- git fetch --no-tags CLICDP ${ILCDIRAC_BRANCH}:${ILCDIRAC_BRANCH}
- git diff -U0 $(git merge-base HEAD CLICDP/$ILCDIRAC_BRANCH) | flake8 --diff
- echo "Formatting correct"
.pylint_template: &pylint
stage: integration
variables:
GIT_STRATEGY: none
except:
- tags
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- unset PYTHONOPTIMIZE
- .gitlab-ci.d/run-pylint.sh
<<: *retry_policy
pylint:SL6:
<<: *sl6docker
<<: *pylint
needs: ["install:SL6"]
pylint:CC7:
<<: *cc7docker
<<: *pylint
needs: ["install:CC7"]
pylint:PY3K:
<<: *sl6docker
stage: integration
variables:
GIT_STRATEGY: none
except:
- tags
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- unset PYTHONOPTIMIZE
- .gitlab-ci.d/run-pylint-py3k.sh
<<: *retry_policy
needs: ["install:SL6"]
.jobTests_template: &jobTests
stage: integration
variables:
GIT_STRATEGY: none
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- dirac-proxy-init --rfc -x <<< $CERT_PASSPHRASE
- dirac-configure -S $SETUP -C dips://voilcdirac012.cern.ch:9135/Configuration/Server --SkipCAChecks
- echo "mysql:x:0:0:MySQL Server:/var/lib/mysql:/bin/bash" >> /etc/passwd
- echo "import coverage; coverage.process_startup()" >> sitecustomize.py
- unset PYTHONOPTIMIZE
- .gitlab-ci.d/run-cvmfstests.sh
coverage: '/\d+\%\s*$/'
<<: *retry_policy
artifacts:
paths:
- installation/ILCDIRAC/tmp*/Local_*/*Step*.log
when: on_failure
expire_in: 2 days
reports:
junit: installation/ILCDIRAC/junit_job.xml
.prodTests_template: &prodTests
stage: integration
except:
- tags
variables:
GIT_STRATEGY: none
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- dirac-proxy-init --rfc -x <<< $CERT_PASSPHRASE
- dirac-configure -S $SETUP -C dips://voilcdirac012.cern.ch:9135/Configuration/Server --SkipCAChecks
- unset PYTHONOPTIMIZE
- cd Tests/productionTest/
- dirac-clic-make-productions -f test_prod.conf --additionalName=$RANDOM
coverage: '/\d+\%\s*$/'
<<: *retry_policy
artifacts:
when: on_failure
expire_in: 2 days
.prodOnly: &prod
only:
- branches@CLICdp/iLCDirac/ILCDIRAC
except:
- tags
allow_failure: false
.devsOnly: &devs
except:
- tags
- branches@CLICdp/iLCDirac/ILCDIRAC
allow_failure: true
.sl6int: &sl6integration
<<: *sl6docker
needs: ["install:SL6", "unittest:SL6"]
.cc7: &cc7integration
<<: *cc7docker
needs: ["install:CC7", "unittest:CC7"]
jobTests:SL6:
<<: *jobTests
<<: *devs
<<: *sl6integration
jobTests:SL6Prod:
<<: *jobTests
<<: *prod
<<: *sl6integration
jobTests:CC7:
<<: *jobTests
<<: *devs
<<: *cc7integration
jobTests:CC7Prod:
<<: *jobTests
<<: *prod
<<: *cc7integration
prodTests:CC7prod:
<<: *prodTests
<<: *prod
<<: *cc7integration
prodTests:CC7dev:
<<: *prodTests
<<: *devs
<<: *cc7integration
.seTests_template: &seTests
stage: integration
variables:
GIT_STRATEGY: none
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- dirac-proxy-init --rfc -x <<< $CERT_PASSPHRASE
- dirac-configure -S $SETUP -C dips://voilcdirac012.cern.ch:9135/Configuration/Server --SkipCAChecks
- dirac-proxy-init --rfc <<< $CERT_PASSPHRASE
- .gitlab-ci.d/run-setests.sh
artifacts:
reports:
junit: installation/ILCDIRAC/junit_se.xml
coverage: '/\d+\%\s*$/'
<<: *retry_policy
only:
- schedules
setests:SL6:
<<: *seTests
<<: *devs
<<: *sl6integration
setests:SL6Prod:
<<: *seTests
<<: *prod
<<: *sl6integration
allow_failure: true
setests:CC7:
<<: *seTests
<<: *devs
<<: *cc7integration
setests:CC7Prod:
<<: *seTests
<<: *prod
<<: *cc7integration
allow_failure: true
compiledoc:
<<: *sl6docker
stage: unittest
variables:
GIT_STRATEGY: none
needs: ["install:SL6"]
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- source ../bashrc
- unset REQUESTS_CA_BUNDLE
- pip install sphinx==1.8.0
- rm -rf ILCDIRAC ## removes just the folder with the links
- wget -O release.notes https://gitlab.cern.ch/CLICdp/iLCDirac/ILCDIRAC/raw/master/release.notes ## get release notes from the master
- cd docs
- export PYTHONPATH=$PWD/source:$PYTHONPATH
- bash patchSphinx.sh
- SPHINXOPTS=-wsphinxWarnings make completeDocumentation
- mv build/html ../../../ilcdiracdoc
- if [ -s sphinxWarnings ]; then cat sphinxWarnings; echo "Warnings When Creating Doc"; exit 1; fi
artifacts:
paths:
- ilcdiracdoc
expire_in: 2 hours
when: always
allow_failure: true
<<: *retry_policy
maketarballs:
<<: *sl6docker
stage: create
only:
- tags@CLICdp/iLCDirac/ILCDIRAC
needs: ["install:SL6"]
script:
- export HOME=/root/
- cd installation/ILCDIRAC
- if [ -d "ILCDIRAC" ]; then echo "ILCDIRAC links still present! Failing!"; exit 1; fi
- source ../bashrc
- dirac-proxy-init --rfc -x <<< $CERT_PASSPHRASE
- dirac-configure -S $SETUP -C dips://voilcdirac012.cern.ch:9135/Configuration/Server --SkipCAChecks
- dirac-proxy-init --rfc <<< $CERT_PASSPHRASE
- echo -e "DefaultModules = ILCDIRAC\n\nSources\n{\n ILCDIRAC = https://gitlab.cern.ch/CLICdp/iLCDirac/ILCDIRAC.git\n}\nReleases\n{\n $CI_COMMIT_TAG\n {\n Modules = ILCDIRAC:$CI_COMMIT_TAG\n Depends = DIRAC:$DIRAC_TAG\n }\n}\n" > thisrelease.cfg
- cat thisrelease.cfg
- dirac-distribution -l ILCDIRAC -r $CI_COMMIT_TAG -D ../../ILCDIRACTars -C thisrelease.cfg
artifacts:
paths:
- ILCDIRACTars
expire_in: 2 hours
<<: *retry_policy
makeILCConfig:
<<: *sl6docker
stage: create
only:
- tags@CLICdp/iLCDirac/ILCDIRAC
except:
- /.*-pre[0-9]*/
needs: ["install:SL6"]
script:
- mkdir -p ILCDIRACTars/defaults; echo -e "Releases = https://gitlab.cern.ch/CLICdp/iLCDirac/ILCDIRAC/raw/master/releases.cfg\nUploadCommand = ( cd %OUTLOCATION% ; tar -cf - *.tar.gz *.md5 *.cfg *.pdf *.html ) | ssh \`whoami\`@lxplus.cern.ch \'cd /eos/project/l/lcd-web/www/ILCDIRACTars && tar -xvf - && ls *.tar.gz > tars.list\'\nBaseURL = http://lcd-data.web.cern.ch/lcd-data/ILCDIRACTars\nLocalInstallation\n{\n Project = ILCDIRAC\n ExternalsType = client\n PythonVersion = 27\n Release = $CI_COMMIT_TAG\n LcgVer = $LCG_BUNDLE_VERSION\n Setup = ILC-Production\n ConfigurationServer = dips://voilcdirac01.cern.ch:9135/Configuration/Server, dips://voilcdirac012.cern.ch:9135/Configuration/Server\n}\n" > ILCDIRACTars/defaults/ilc.cfg
artifacts:
paths:
- ILCDIRACTars
expire_in: 2 hours
<<: *retry_policy
deploydoc:
stage: deploy
tags:
- docker
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
only:
- tags@CLICdp/iLCDirac/ILCDIRAC
except:
- /.*-pre[0-9]*/
needs: ["compiledoc"]
variables:
EOS_PATH: "/eos/project/l/lcd-web/www/doc/ilcdiracdoc/"
CI_OUTPUT_DIR: "ilcdiracdoc"
script:
- deploy-eos
before_script: []
after_script: []
<<: *retry_policy
docDev:
stage: deploy
tags:
- docker
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
when: manual
except:
- tags
needs: ["compiledoc", "unittest:SL6"]
variables:
EOS_PATH: "/eos/project/l/lcd-web/www/doc/ilcdiracdocDev/"
CI_OUTPUT_DIR: "ilcdiracdoc"
script:
- mv installation/ILCDIRAC/htmlcov ilcdiracdoc/ || echo "No htmlcov"
- deploy-eos
before_script: []
after_script: []
<<: *retry_policy
docProd:
stage: deploy
tags:
- docker
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
only:
- branches@CLICdp/iLCDirac/ILCDIRAC
when: manual
needs: ["compiledoc", "unittest:SL6"]
variables:
EOS_PATH: "/eos/project/l/lcd-web/www/doc/ilcdiracdoc/"
CI_OUTPUT_DIR: "ilcdiracdoc"
script:
- mv installation/ILCDIRAC/htmlcov ilcdiracdoc/ || echo "No htmlcov"
- deploy-eos
before_script: []
after_script: []
<<: *retry_policy
deploytag:
stage: deploy
tags:
- docker
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
only:
- tags@CLICdp/iLCDirac/ILCDIRAC
needs: ["maketarballs", "makeILCConfig"]
variables:
EOS_PATH: "/eos/project/l/lcd-web/www/ILCDIRACTars/"
CI_OUTPUT_DIR: "ILCDIRACTars"
script:
- deploy-eos
before_script: []
after_script: []
<<: *retry_policy
deployToCVMFS:
stage: deployToCVMFS
tags:
- cvmfs
only:
- tags@CLICdp/iLCDirac/ILCDIRAC
except:
- /.*-pre[0-9]*/
needs: ["deploytag"]
script:
- sudo -u cvclicdp -i scripts/installILCDIRAC.sh $CI_COMMIT_TAG $CERT_PASSPHRASE
before_script: []
after_script: []