-
Notifications
You must be signed in to change notification settings - Fork 39
/
.gitlab-ci.yml
1211 lines (1049 loc) · 41.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
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
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ************************************************************************
# * EOS - the CERN Disk Storage System *
# * Copyright (C) 2023 CERN/Switzerland *
# * *
# * This program is free software: you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation, either version 3 of the License, or *
# * (at your option) any later version. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU General Public License for more details. *
# * *
# * You should have received a copy of the GNU General Public License *
# * along with this program. If not, see <http://www.gnu.org/licenses/>.*
# ************************************************************************
stages:
- build:manual
- prebuild
- build:rpm
- build:dockerimage
- test
- publish
- clean
variables:
CODENAME: "diopside"
default:
before_script:
- source gitlab-ci/export_commit-type.sh
- echo "Exporting COMMIT_TYPE=${COMMIT_TYPE}"
include:
# - template: Code-Quality.gitlab-ci.yml
# - local: /gitlab-ci/.gitlab-ci-test-dock_include.yml @note on the file
# - local: /gitlab-ci/.gitalb-ci-build-macos.yml
- local: /gitlab-ci/.gitlab-ci-build-ubuntu.yml
- local: /gitlab-ci/.gitlab-ci-test-k8s_include.yml
- local: /gitlab-ci/.gitlab-ci-test-helm_include.yml
workflow:
rules:
- if: $CI_COMMIT_BRANCH
variables:
KOJI_SCRATCH: "--scratch --skip-tag"
- if: $CI_COMMIT_TAG
variables:
KOJI_SCRATCH: ""
#-------------------------------------------------------------------------------
# Prebuild
#-------------------------------------------------------------------------------
.prebuild-template: &prebuild-template_definition
stage: prebuild
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- export DESTINATION="gitlab-registry.cern.ch/dss/eos/prebuild-${PREBUILD_NAME}-${CODENAME}"
- export DOCKERFILE="$CI_PROJECT_DIR/gitlab-ci/prebuild_OSbase/prebuild-${PREBUILD_NAME}.Dockerfile"
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64)\"}}}" > /kaniko/.docker/config.json
# no need yet for --build-arg PREBUILD_NAME="$PREBUILD_NAME" --build-arg CMAKE_OPTIONS="$CMAKE_OPTIONS" --build-arg CXXFLAGS="$CXXFLAGS"
- /kaniko/executor --cache="false" --destination $DESTINATION --dockerfile $DOCKERFILE --context $CI_PROJECT_DIR --build-arg=EOS_CODENAME="${CODENAME}" --compressed-caching=false --use-new-run
only:
variables:
- $PREBUILD_TRIGGER
prebuild-cc7:
extends: .prebuild-template
variables:
PREBUILD_NAME: cc7
prebuild-el8:
extends: .prebuild-template
variables:
PREBUILD_NAME: el8
prebuild-el9:
extends: .prebuild-template
variables:
PREBUILD_NAME: el9
prebuild-el9-arm64:
extends: .prebuild-template
variables:
PREBUILD_NAME: el9-arm64
tags:
- k8s-arm
.prebuild-cc7_coverage:
extends: .prebuild-template
variables:
PREBUILD_NAME: cc7_coverage
only:
variables:
- $COVERAGE_SCHEDULE
clone_docker:
stage: build:rpm
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
script:
- dnf install --nogpg -y git
- git clone https://gitlab.cern.ch/eos/eos-docker.git
artifacts:
expire_in: 1 day
paths:
- eos-docker/
#-------------------------------------------------------------------------------
# Build RPMs
#-------------------------------------------------------------------------------
.build-template: &build-template_definition
stage: build:rpm
variables:
PKG_MGR: dnf
CMAKE_BIN: cmake
script:
- git submodule sync --recursive && git submodule update --init -f --recursive
- mkdir build; cd build; ${CMAKE_BIN} .. -DPACKAGEONLY=1 -DEOS_GRPC_GW=1 -Wno-dev; make srpm; cd ..;
- echo -e "[eos-depend]\nname=EOS dependencies\nbaseurl=http://storage-ci.web.cern.ch/storage-ci/eos/${CODENAME}-depend/el-$(rpm --eval '%{rhel}')/$(uname -m)/\ngpgcheck=0\nenabled=1\npriority=2\n" >> /etc/yum.repos.d/eos-depend.repo
- |
if [[ ${PKG_MGR} == "yum" ]]; then
${PKG_MGR} remove --nogpgcheck -y eos-xrootd;
${PKG_MGR}-builddep --nogpgcheck -y --setopt="cern*.exclude=xrootd*" build/SRPMS/*;
else
${PKG_MGR} builddep --nogpgcheck --allowerasing -y --setopt="cern*.exclude=xrootd*" build/SRPMS/*;
fi
- |
if [[ -n "$CI_COMMIT_TAG" ]]; then
export CCACHE_DISABLE=1;
else
source gitlab-ci/setup_ccache.sh;
fi
- rpmbuild --rebuild --with server --with eos_grpc_gateway --define "_rpmdir build/RPMS/" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" build/SRPMS/* | (ts 2> dev/null || true; tee)
- ccache -s
- if [[ -n "$CI_COMMIT_TAG" ]]; then gpg2 --import $STCI_REPO_KEY; printf "" | setsid rpmsign --define='%_gpg_name [email protected]' --define='%_signature gpg' --addsign build/RPMS/*.rpm; fi
- mkdir ${BUILD_NAME}_artifacts; cp -rv build/*RPMS/ build/eos-*.tar.gz ${BUILD_NAME}_artifacts
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- ccache/
artifacts:
expire_in: 60 days
paths:
- ${BUILD_NAME}_artifacts/
build_cc7:
image: gitlab-registry.cern.ch/dss/eos/prebuild-cc7-${CODENAME}
variables:
PKG_MGR: yum
BUILD_NAME: cc7
CMAKE_BIN: cmake3
extends: .build-template
build_el8:
image: gitlab-registry.cern.ch/dss/eos/prebuild-el8-${CODENAME}
variables:
BUILD_NAME: el-8
extends: .build-template
only:
- schedules
- tags
build_el9:
image: gitlab-registry.cern.ch/dss/eos/prebuild-el9-${CODENAME}
variables:
BUILD_NAME: el-9
extends: .build-template
build_el9_arm64:
image: gitlab-registry.cern.ch/dss/eos/prebuild-el9-arm64-${CODENAME}
variables:
BUILD_NAME: el-9-arm64
extends: .build-template
tags:
- k8s-arm
#-------------------------------------------------------------------------------
# EOS client builds for RHEL
#-------------------------------------------------------------------------------
.build-client-srpm-template: &build-client-srpm-template_definition
stage: build:rpm
script:
- dnf config-manager --add-repo https://linuxsoft.cern.ch/cern/rhel/$(rpm --eval '%{rhel}')/CERN/$(uname -i)/ --set-enabled
- dnf install cern-gpg-keys --nogpgcheck -y
- rpm --import /etc/pki/rpm-gpg/*
- dnf install rpm-build cmake gcc-c++ git -y
- git submodule sync --recursive && git submodule update --init -f --recursive
- mkdir -pv build; cd build;
- cmake ../ -DPACKAGEONLY=1 -DCLIENT=1 -Wno-dev
- make srpm; cd ..;
- mkdir -p ${CI_JOB_NAME}_artifacts
- cp -rv build/SRPMS/ ${CI_JOB_NAME}_artifacts
artifacts:
expire_in: 60 days
paths:
- ${CI_JOB_NAME}_artifacts
only:
- schedules
- tags
rh-8:
extends: .build-client-srpm-template
image: gitlab-registry.cern.ch/linuxsupport/ubi8/ubi
rh-9:
extends: .build-client-srpm-template
image: gitlab-registry.cern.ch/linuxsupport/ubi9/ubi
#-------------------------------------------------------------------------------
# Fedora builds
#-------------------------------------------------------------------------------
.build-fedora-template: &build-fedora-template_definition
stage: build:rpm
script:
- dnf install --nogpg -y gcc-c++ cmake make rpm-build which git tar dnf-plugins-core ccache rpm-sign
- git submodule sync --recursive && git submodule update --init -f --recursive
- mkdir build; cd build
- cmake .. -DPACKAGEONLY=1 -Wno-dev; make srpm; cd ..
- echo -e "[eos-depend]\nname=EOS dependencies\nbaseurl=http://storage-ci.web.cern.ch/storage-ci/eos/${CODENAME}-depend/${BUILD_NAME}/x86_64/\ngpgcheck=0\nenabled=1\nexclude=xrootd*\npriority=4\n" > /etc/yum.repos.d/eos-depend.repo
- dnf builddep --nogpgcheck --allowerasing -y build/SRPMS/*
- if [[ -n "$CI_COMMIT_TAG" ]]; then export CCACHE_DISABLE=1; else source gitlab-ci/setup_ccache_fc.sh; fi
- rpmbuild --rebuild --with server --define "_rpmdir build/RPMS/" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" build/SRPMS/*
- ccache -s
- if [[ -n "$CI_COMMIT_TAG" ]]; then gpg2 --import $STCI_REPO_KEY; printf "" | setsid rpmsign --define='%_gpg_name [email protected]' --define='%_signature gpg' --addsign build/RPMS/*.rpm; fi
- mkdir ${BUILD_NAME}_artifacts; cp -R build/SRPMS build/RPMS ${BUILD_NAME}_artifacts
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- ccache/
artifacts:
expire_in: 60 days
paths:
- ${BUILD_NAME}_artifacts/
allow_failure: true
build_fedora_38:
extends: .build-fedora-template
image: fedora:38
variables:
BUILD_NAME: fc-38
only:
- schedules
- tags
build_fedora_rawhide:
extends: .build-fedora-template
image: registry.fedoraproject.org/fedora:rawhide
variables:
BUILD_NAME: fc-rawhide
only:
- schedules
when: manual
#-------------------------------------------------------------------------------
# Exotic builds
#-------------------------------------------------------------------------------
.build_exotic-template: &build_exotic-template_definition
stage: build:rpm
variables:
PKG_MGR: dnf
CMAKE_CMD: cmake3
script:
- export DIST=$(rpm --eval '%{rhel}')
- ${PKG_MGR} install -y git ccache tar sudo which tar gzip moreutils
- git submodule sync --recursive && git submodule update --init -f --recursive
- mkdir build; cd build
- ${CMAKE_CMD} .. -DPACKAGEONLY=1 ${CMAKE_OPTIONS} -Wno-dev
- make srpm; cd ..;
- |
if [[ "$RPMBUILD_OPTIONS" == *asan* ]]; then
echo -e "[eos-asan-depend]\nname=EOS dependencies\nbaseurl=http://storage-ci.web.cern.ch/storage-ci/eos/${CODENAME}-depend/el-${DIST}-asan/x86_64/\ngpgcheck=0\nenabled=1\npriority=2\n" > /etc/yum.repos.d/eos-depend.repo;
# Install the asan enabled dependencies
${PKG_MGR} remove -y eos-xrootd eos-folly eos-grpc eos-rocksdb || true;
elif [[ "$RPMBUILD_OPTIONS" == *tsan* ]]; then
echo -e "[eos-tsan-depend]\nname=EOS dependencies\nbaseurl=http://storage-ci.web.cern.ch/storage-ci/eos/${CODENAME}-depend/el-${DIST}-tsan/x86_64/\ngpgcheck=0\nenabled=1\npriority=2\n" > /etc/yum.repos.d/eos-depend.repo;
# Install the tsan enabled dependencies
${PKG_MGR} remove -y eos-xrootd eos-folly eos-grpc eos-rocksdb || true;
else
echo -e "[eos-depend]\nname=EOS dependencies\nbaseurl=http://storage-ci.web.cern.ch/storage-ci/eos/${CODENAME}-depend/el-${DIST}/x86_64/\ngpgcheck=0\nenabled=1\npriority=2\n" > /etc/yum.repos.d/eos-depend.repo;
fi
- |
if [[ ${PKG_MGR} == "yum" ]]; then
${PKG_MGR}-builddep --nogpgcheck --setopt="cern*.exclude=xrootd*" -y build/SRPMS/*;
else
${PKG_MGR} install -y dnf-plugins-core;
${PKG_MGR} builddep --nogpgcheck --setopt="cern*.exclude=xrootd*" -y build/SRPMS/*;
fi
- if [[ -n "$CI_COMMIT_TAG" ]]; then export CCACHE_DISABLE=1; else source gitlab-ci/setup_ccache.sh; fi
- rpmbuild --rebuild ${RPMBUILD_OPTIONS} --define "_rpmdir build/RPMS/" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" build/SRPMS/* | ts
- ccache -s
- if [[ -n "$CI_COMMIT_TAG" ]]; then gpg --import $STCI_REPO_KEY; printf "" | setsid rpmsign --define='%_gpg_name [email protected]' --define='%_signature gpg' --addsign build/RPMS/*.rpm; fi
- mkdir ${BUILD_NAME}_artifacts; cp -R build/SRPMS/ build/RPMS/ ${BUILD_NAME}_artifacts
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- ccache/
artifacts:
expire_in: 1 day
paths:
- ${BUILD_NAME}_artifacts/
dependencies: []
allow_failure: true
build_cc7_asan:
image: gitlab-registry.cern.ch/dss/eos/prebuild-cc7-${CODENAME}
variables:
PKG_MGR: yum
BUILD_NAME: cc7_asan
CMAKE_OPTIONS: "-DASAN=1"
RPMBUILD_OPTIONS: "--with server --with asan"
CXXFLAGS: "-Wno-parentheses" # Avoid boost header compilation errors
before_script:
- ${PKG_MGR} install -y cmake3 centos-release-scl libasan5
- ${PKG_MGR} install -y devtoolset-9-gcc-c++ devtoolset-9-libasan-devel
extends: .build_exotic-template
when: manual
build_client_cc7_tsan:
image: gitlab-registry.cern.ch/dss/eos/prebuild-cc7-${CODENAME}
variables:
PKG_MGR: yum
BUILD_NAME: cc7_tsan
CMAKE_OPTIONS: "-DTSAN=1"
RPMBUILD_OPTIONS: "--with tsan"
CXXFLAGS: "-Wno-parentheses" # Avoid boost header compilation errors
before_script:
- ${PKG_MGR} install -y cmake3 centos-release-scl
- ${PKG_MGR} install -y libtsan --disablerepo=* --enablerepo=centos-sclo-rh
- ${PKG_MGR} install -y devtoolset-9-gcc-c++ devtoolset-9-libtsan-devel
extends: .build_exotic-template
when: manual
build_el9_asan:
image: gitlab-registry.cern.ch/dss/eos/prebuild-el9-${CODENAME}
variables:
CMAKE_CMD: cmake
BUILD_NAME: el-9-asan
CMAKE_OPTIONS: "-DASAN=1"
RPMBUILD_OPTIONS: "--with server --with asan"
CXXFLAGS: "-Wno-parentheses" # Avoid boost header compilation errors
before_script:
- ${PKG_MGR} install -y epel-release libasan cmake gcc gcc-c++ rpmdevtools
extends: .build_exotic-template
when: manual
build_client_el9_tsan:
image: gitlab-registry.cern.ch/dss/eos/prebuild-el9-${CODENAME}
variables:
CMAKE_CMD: cmake
BUILD_NAME: el-9-tsan
CMAKE_OPTIONS: "-DTSAN=1"
RPMBUILD_OPTIONS: "--with tsan"
CXXFLAGS: "-Wno-parentheses" # Avoid boost header compilation errors
before_script:
- ${PKG_MGR} install -y epel-release libtsan cmake gcc gcc-c++ which rpmdevtools
extends: .build_exotic-template
when: manual
build_el9_clang:
image: gitlab-registry.cern.ch/dss/eos/prebuild-el9-${CODENAME}
variables:
BUILD_NAME: el-9-clang
CMAKE_OPTIONS: "-DCLANG_BUILD=1"
RPMBUILD_OPTIONS: "--with clang --with server"
extends: .build_exotic-template
only:
- schedules
- triggers
# @note Please contact CTA team / jleduc if you want to change this job
build_cc7_opt_xrootd:
image: gitlab-registry.cern.ch/dss/eos/prebuild-cc7-${CODENAME}
variables:
PKG_MGR: yum
BUILD_NAME: cc7_opt_xrootd
CMAKE_OPTIONS: "-DEOS_XROOTD=1"
RPMBUILD_OPTIONS: "--with eos_xrootd_rh"
before_script:
- sed -i "s/pgm \/usr\/bin\/xrdcp/pgm \/bin\/true/g" misc/etc/xrd.cf.fst
except:
- tags
extends: .build_exotic-template
when: manual
build_cc7_coverage:
image: gitlab-registry.cern.ch/dss/eos/prebuild-cc7-${CODENAME}
variables:
PKG_MGR: yum
BUILD_NAME: cc7_coverage
RPMBUILD_OPTIONS: "--with coverage"
only:
variables:
- $COVERAGE_SCHEDULE
extends: .build_exotic-template
#-------------------------------------------------------------------------------
# Build docker images
#-------------------------------------------------------------------------------
.build_dockerimage-template:
stage: build:dockerimage
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
EXTRA_TAG: ""
script:
# @note keep $CACHE orthogonal to $IMAGE_TAG, do not join the "if"s
- if [[ -n "$CI_COMMIT_TAG" ]] || [[ "x$CI_PIPELINE_SOURCE" == "xschedule" ]];
then CACHE="false";
else CACHE="true";
fi
- if [[ -n "$CI_COMMIT_TAG" ]];
then IMAGE_TAG="$CI_COMMIT_TAG${OS_TAG}{EXTRA_TAG}";
else IMAGE_TAG="$CI_COMMIT_SHORT_SHA${OS_TAG}${EXTRA_TAG}";
fi
- IMAGE_REPO="gitlab-registry.cern.ch/dss/eos/eos-ci"
- DESTINATION="${IMAGE_REPO}:${IMAGE_TAG}"
- echo "CACHE=$CACHE - DESTINATION=$DESTINATION"
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64)\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --cache=$CACHE --destination $DESTINATION --dockerfile $DOCKERFILE --context $CI_PROJECT_DIR --build-arg=EOS_CODENAME="${CODENAME}" --compressed-caching=false --use-new-run
retry: 1
cc7_docker_image:
extends: .build_dockerimage-template
variables:
DOCKERFILE: eos-docker/Dockerfile
OS_TAG: ".el7"
needs:
- job: clone_docker
- job: build_cc7
cc7_asan_docker_image:
extends: .build_dockerimage-template
variables:
DOCKERFILE: eos-docker/Dockerfile_cc7_asan
EXTRA_TAG: "_asan"
OS_TAG: ".el7"
needs:
- job: clone_docker
- job: build_cc7_asan
when: manual
allow_failure: true
el9_docker_image:
extends: .build_dockerimage-template
variables:
DOCKERFILE: eos-docker/Dockerfile_el9
OS_TAG: ".el9"
needs:
- job: clone_docker
- job: build_el9
el9_asan_docker_image:
extends: .build_dockerimage-template
variables:
DOCKERFILE: eos-docker/Dockerfile_el9_asan
EXTRA_TAG: "_asan"
OS_TAG: ".el9"
needs:
- job: clone_docker
- job: build_el9_asan
when: manual
allow_failure: true
.cc7_coverage_docker_image:
extends: .build_dockerimage-template
variables:
DOCKERFILE: eos-docker/Dockerfile_coverage
EXTRA_TAG: "_coverage"
OS_TAG: ".el7"
needs:
- job: clone_docker
- job: build_cc7_coverage
only:
variables:
- $COVERAGE_SCHEDULE
allow_failure: true
#-------------------------------------------------------------------------------
# Code quality, from codeclimate plugins - disabled
#-------------------------------------------------------------------------------
# .code_quality:
# artifacts:
# paths: [gl-code-quality-report.json]
# rules:
# - if: '$CI_PIPELINE_SOURCE == "schedule"'
# allow_failure: true
# .code_quality_html:
# extends: code_quality
# variables:
# REPORT_FORMAT: html
# artifacts:
# paths: [gl-code-quality-report.html]
#-------------------------------------------------------------------------------
# Dock8rnetes testing framework (exec_cmd wraps both docker and k8s!)
#-------------------------------------------------------------------------------
.dock8s_before_script_template: &dock8s_before_script_template
stage: test
before_script:
- case $CI_JOB_NAME in
"k8s"* )
source ./gitlab-ci/before_script_k8s_test.sh;
source ./gitlab-ci/utilities_func_for_tests.sh --type k8s $K8S_NAMESPACE ;;
"dock"* )
source ./gitlab-ci/before_script_docker_test.sh;
source ./gitlab-ci/utilities_func_for_tests.sh --type docker; ;;
esac
variables:
OS_TAG: ".el9"
.dock8s_after_script_template: &dock8s_after_script_template
after_script:
- case $CI_JOB_NAME in
"k8s"* )
source ./gitlab-ci/after_script_k8s_test.sh ;;
"dock"* )
source ./gitlab-ci/after_script_docker_test.sh ;;
esac
.dock8s_system_test_template:
extends:
- .dock8s_before_script_template
- .dock8s_after_script_template
script:
- date
- exec_cmd eos-mgm1 'eos ns mutex --toggleorder'
- exec_cmd eos-mgm1 'eos-instance-test-ci'
- date
- exec_cmd eos-mgm1 'eos-unit-tests-with-instance -n root://localhost//eos/dockertest/'
- exec_cmd eos-mgm1 'grep "RWMutex. Order Checking Error in thread" /var/log/eos/mgm/xrdlog.mgm && exit 1 || exit 0'
- date
- cp_to_local_cmd eos-cli1:/usr/sbin/eos-test-utils ./eos-test-utils; chmod +x eos-test-utils
- cp_to_local_cmd eos-cli1:/usr/sbin/eos-fst-close-test ./eos-fst-close-test; chmod +x eos-fst-close-test
- case $CI_JOB_NAME in
"k8s"* )
export EOS_MGM_URL="root://eos-mgm1.eos-mgm1.$K8S_NAMESPACE.svc.cluster.local";
./eos-fst-close-test --mgm ${EOS_MGM_URL} --type k8s $K8S_NAMESPACE ;;
"dock"* )
./eos-fst-close-test --type docker ;;
esac
- date
artifacts:
when: on_failure
expire_in: 3 days
paths:
- eos-logs-${CI_JOB_ID}/
.dock8s_cnvrt_fsck_template:
extends:
- .dock8s_before_script_template
- .dock8s_after_script_template
script:
- cp_to_local_cmd eos-cli1:/usr/sbin/eos-test-utils ./eos-test-utils; chmod +x eos-test-utils
- cp_to_local_cmd eos-cli1:/usr/sbin/eos-convert-test ./eos-convert-test; chmod +x eos-convert-test
- cp_to_local_cmd eos-cli1:/usr/sbin/eos-fsck-test ./eos-fsck-test; chmod +x eos-fsck-test
- case $CI_JOB_NAME in
"k8s"* )
./eos-convert-test --type k8s $K8S_NAMESPACE;
./eos-fsck-test --max-delay 600 --type k8s $K8S_NAMESPACE ;;
"dock"* )
./eos-convert-test --type docker;
./eos-fsck-test --max-delay 600 --type docker ;;
esac
- rm -rf eos-convert-test
- rm -rf eos-fsck-test
- rm -rf eos-test-utils
artifacts:
when: on_failure
expire_in: 3 days
paths:
- eos-logs-${CI_JOB_ID}/
.dock8s_rtb_clone_template:
extends:
- .dock8s_before_script_template
- .dock8s_after_script_template
script:
# prepare mountpoints
- exec_cmd eos-cli1 'atd; at now <<< "mkdir -p /eos1/ && mount -t fuse eosxd -ofsname=mount-1 /eos1/; mkdir -p /eos2/ && mount -t fuse eosxd -ofsname=mount-2 /eos2/;"'
- exec_cmd eos-cli1 'count=0; while [[ $count -le 10 ]] && ( [[ ! -d /eos1/dockertest/ ]] || [[ ! -d /eos2/dockertest/ ]] ); do echo "Wait for mount... $count"; (( count++ )); sleep 1; done;'
# download tests repo
- exec_cmd eos-cli1 'git clone https://gitlab.cern.ch/dss/eosclient-tests.git'
# ubuntu releases do not support 'clone' yet, skip its test
- case $CI_JOB_NAME in
"ub_focal"* | "ub_jammy"* ) ;;
* ) exec_cmd eos-cli1 'cd /eosclient-tests; clone_tests/clone_test.sh prepare; rc=$?; exit $rc' ;;
esac
artifacts:
when: on_failure
expire_in: 3 days
paths:
- eos-logs-${CI_JOB_ID}/
.dock8s_fusex_test_template:
extends:
- .dock8s_before_script_template
- .dock8s_after_script_template
script:
# prepare mountpoints
- exec_cmd eos-cli1 'atd; at now <<< "mkdir -p /eos1/ && mount -t fuse eosxd -ofsname=mount-1 /eos1/; mkdir -p /eos2/ && mount -t fuse eosxd -ofsname=mount-2 /eos2/;"'
- exec_cmd eos-cli1 'count=0; while [[ $count -le 10 ]] && ( [[ ! -d /eos1/dockertest/ ]] || [[ ! -d /eos2/dockertest/ ]] ); do echo "Wait for mount... $count"; (( count++ )); sleep 1; done;'
# fusex functional bindings
- exec_cmd eos-cli1 'atd; at now <<< "mkdir -p /eosfunctionaltest/ && mount -t fuse eosxd -ofsname=eosdockertest /eosfunctionaltest/;"'
- exec_cmd eos-cli1 'count=0; while [[ $count -le 10 ]] && [[ ! -d /eosfunctionaltest/dockertest/ ]] ; do echo "Wait for mount... $count"; (( count++ )); sleep 1; done;'
- exec_cmd eos-cli1 'su eos-user -c "mkdir -m 700 -p /eosfunctionaltest/dockertest/credentialtest/ && cd /eosfunctionaltest/dockertest/credentialtest/"'
- exec_cmd eos-cli1 'su eos-user -c "eos-test-credential-bindings /eosfunctionaltest/dockertest/credentialtest/"'
# fusex benchmark
- exec_cmd eos-mgm1 'eos ns mutex --toggleorder'
- exec_cmd eos-cli1 'su eos-user -c "mkdir -p /eos1/dockertest/fusex_tests/ && cd /eos1/dockertest/fusex_tests/ && fusex-benchmark"'
- exec_cmd eos-mgm1 'grep "RWMutex. Order Checking Error in thread" /var/log/eos/mgm/xrdlog.mgm && exit 1 || exit 0'
# download tests repo
- exec_cmd eos-cli1 'git clone https://gitlab.cern.ch/dss/eosclient-tests.git'
# @todo(esindril): run "all" tests in schedule mode once these are properly supported
# if [[ "$CI_PIPELINE_SOURCE" == "schedule" ]];
# then
# exec_cmd eos-mgm1 'eos vid add gateway "eos-cli1.eos-cli1.${K8S_NAMESPACE}.svc.cluster.local" unix';
# exec_cmd eos-cli1 'env EOS_FUSE_NO_ROOT_SQUASH=1 python3 /eosclient-tests/run.py --workdir="/eos1/dockertest /eos2/dockertest" ci';
# fi
# until then just run the "ci" tests
- exec_cmd eos-cli1 'cd eosclient-tests; for n in prepare/*.sh; do /bin/bash $n prepare; done'
- exec_cmd eos-cli1 'su eos-user -c "python3 /eosclient-tests/run.py --workdir=\"/eos1/dockertest /eos2/dockertest\" ci"'
- exec_cmd eos-cli1 'cd eosclient-tests; for n in prepare/*.sh; do /bin/bash $n cleanup; done'
# fusex test SAMBA gateways authentication settings
# this will run on the client pod
- exec_cmd eos-mgm1 'eos vid enable sss'
- exec_cmd eos-mgm1 'eos vid enable unix'
- CLI_POD_HOSTNAME="$(exec_cmd eos-cli1 'hostname -f')"
- echo ${CLI_POD_HOSTNAME}
- exec_cmd eos-mgm1 "eos vid add gateway ${CLI_POD_HOSTNAME} unix"
- exec_cmd eos-cli1 'eos-fusex-functional-test --samba'
artifacts:
when: on_failure
expire_in: 3 days
paths:
- eos-logs-${CI_JOB_ID}/
.dock8s_cbox_test_template:
extends:
- .dock8s_before_script_template
- .dock8s_after_script_template
script:
# enable converter and prepare eoshome folder, cernbox alike
- exec_cmd eos-mgm1 'eos space config default space.converter=on'
- exec_cmd eos-mgm1 './eos_create_userhome.sh eos-user'
# prepare mountpoints
- exec_cmd eos-cli1 'atd; at now <<< "mkdir -p /eos/ && mount -t fuse eosxd -ofsname=eosdockertest /eos/"'
- exec_cmd eos-cli1 'count=0; while [[ $count -le 10 ]] && ( [[ ! -d /eos/ ]] ); do echo "Wait for mount... $count"; (( count++ )); sleep 1; done;'
# set krb5 ticket and download tests repo @note the 'export KRB5CCNAME to FILE: type' is a spooky trick, can be made nicer.
- exec_cmd eos-cli1 'echo -e "export KRB5CCNAME=FILE:/tmp/krb5cc_$(id -u eos-user)" >> ~/.bashrc'
- exec_cmd eos-cli1 'su eos-user -c "kinit [email protected] -k -t /home/eos-user/eos-user.keytab"'
- exec_cmd eos-cli1 'su eos-user -c "git clone https://gitlab.cern.ch/dss/eosclient-tests.git /eos/user/e/eos-user/eosclient-tests"'
# launch the tests
- exec_cmd eos-cli1 'su eos-user -c "cd /eos/user/e/eos-user && python3 ./eosclient-tests/run.py --workdir=/eos/user/e/eos-user ci-eosfuse_release"'
- exec_cmd eos-cli1 'su eos-user -c "cd /eos/user/e/eos-user && python3 ./eosclient-tests/run.py --workdir=/eos/user/e/eos-user regression"'
artifacts:
when: on_failure
expire_in: 3 days
paths:
- eos-logs-${CI_JOB_ID}/
.dock8s_flamegraph_test_template:
extends:
- .dock8s_before_script_template
- .dock8s_after_script_template
script:
- date
- echo 0 > /proc/sys/kernel/perf_event_paranoid; cat /proc/sys/kernel/perf_event_paranoid
- echo 0 > /proc/sys/kernel/kptr_restrict; cat /proc/sys/kernel/kptr_restrict
- exec_cmd eos-mgm1 "mkdir eos-flamegraph-data; cd eos-flamegraph-data; /usr/sbin/eos-make-flamegraph"
artifacts:
expire_in: 1 days
paths:
- eos-logs-${CI_JOB_ID}/
.unit_test_template: &unit_test_template_definition
stage: test
variables:
OS_TAG: ".el9"
script:
# generic unit tests
- eos-unit-tests
- eos-unit-tests-fst
- eos-fusex-tests
- pip3 install pytest; python3 -m pytest /usr/sbin/test-eos-iam-mapfile.py
# namespace specific unit tests
- export EOS_QUARKDB_HOSTPORT=localhost:7777
- quarkdb-create --path /var/quarkdb/node-0
- chown -R daemon:daemon /var/quarkdb/node-0
- xrootd -n qdb -c /etc/xrd.cf.quarkdb -l /var/log/eos/xrdlog.qdb -b -Rdaemon
- eos-ns-quarkdb-tests
- cp /usr/sbin/qclient-tests . && GTEST_DEATH_TEST_USE_FORK=1 ./qclient-tests
needs:
- job: el9_docker_image
artifacts: false
retry: 1
tags:
- docker_node
- dock
unit_test:tag:
extends: .unit_test_template
image:
name: gitlab-registry.cern.ch/dss/eos/eos-ci:${CI_COMMIT_TAG}${OS_TAG}
entrypoint: ["/bin/bash", "-c"]
only:
- tags
unit_test:
extends: .unit_test_template
image:
name: gitlab-registry.cern.ch/dss/eos/eos-ci:${CI_COMMIT_SHORT_SHA}${OS_TAG}
entrypoint: ["/bin/bash", "-c"]
except:
- tags
unit_test_asan:
extends: .unit_test_template
image:
name: gitlab-registry.cern.ch/dss/eos/eos-ci:${CI_COMMIT_SHORT_SHA}${OS_TAG}${EXTRA_TAG}
entrypoint: ["/bin/bash", "-c"]
variables:
LSAN_OPTIONS: "suppressions=/var/eos/test/LeakSanitizer.supp" # Suppress known memory leaks. For the generic tests
ASAN_OPTIONS: "fast_unwind_on_malloc=0" # Avoid indirect leaks from linked dependencies. For the namespace tests
EXTRA_TAG: "_asan"
needs:
- job: el9_asan_docker_image
artifacts: false
when: manual
allow_failure: true
#-------------------------------------------------------------------------------
# RPM publishing
#-------------------------------------------------------------------------------
.publish_koji_template: &publish_koji_template_definition
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/rpmci/kojicli
script:
- yum install --nogpg -y sssd-client
- kinit [email protected] -k -t /stci.krb5/stci.keytab
# KOJI_SCRATCH will be set for branches and empty for tags
- koji build ${KOJI_SCRATCH} ${TARGET} ${BUILD_NAME}_artifacts/SRPMS/*.src.rpm
only:
- schedules
- tags
tags:
- docker_node
- publish
when: manual
publish_koji_cc7:
<<: *publish_koji_template_definition
variables:
TARGET: "eos7"
BUILD_NAME: "cc7"
dependencies:
- build_cc7
publish_koji_al8:
<<: *publish_koji_template_definition
variables:
TARGET: "eos8al"
BUILD_NAME: "el-8"
dependencies:
- build_el8
publish_koji_al9:
<<: *publish_koji_template_definition
variables:
TARGET: "eos9al"
BUILD_NAME: "el-9"
dependencies:
- build_el9
publish_koji_rh-8:
<<: *publish_koji_template_definition
variables:
TARGET: "eos8el"
BUILD_NAME: "rh-8"
needs:
- job: rh-8
publish_koji_rh-9:
<<: *publish_koji_template_definition
variables:
TARGET: "eos9el"
BUILD_NAME: "rh-9"
needs:
- job: rh-9
email_notification:
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
variables:
ENV: production
TO_ADDRS: [email protected],[email protected]
script:
- dnf install -y git python pip
- git clone https://token:[email protected]/eos/eos-mailservices-code-samples.git
- cd eos-mailservices-code-samples/Python/oauth2-samples; pip install --no-input -r requirements.txt
- export EOS_VERSION=$CI_COMMIT_TAG
- python -m oauth2_smtp
needs:
- job: publish_koji_al9
only:
- tags
notify_cta_project:
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
script:
- |
dnf install --nogpg -y git curl gawk jq
# Variables
EOS_TAG_NAME=$(git describe --tags --exact-match || echo "not-a-tag")
CTA_PROJECT_ID="139306"
CTA_PROJECT_API="https://gitlab.cern.ch/api/v4/projects/$CTA_PROJECT_ID"
TRIGGER_URL="$CTA_PROJECT_API/trigger/pipeline"
# Extract versions from eos.spec.in
XROOTD_VERSION=$(grep '^%define xrootd_version_min' eos.spec.in | awk '{print $3}')
# Fetch the latest tag from the CTA project
LATEST_CTA_TAG=$(curl --silent "$CTA_PROJECT_API/repository/tags?order_by=updated&sort=desc" | jq -r '.[0].name')
echo "Latest tag from the CTA project: $LATEST_CTA_TAG"
if [ "$EOS_TAG_NAME" != "not-a-tag" ]; then
# Trigger the external CTA pipeline using the latest CTA and EOS tags
curl -X POST \
-F token=$CTA_TRIGGER_TOKEN \
-F ref=$LATEST_CTA_TAG \
-F "variables[TAG_NAME]=$EOS_TAG_NAME" \
-F "variables[XROOTD_VERSION]=$XROOTD_VERSION" \
$TRIGGER_URL
# Trigger the external CTA pipeline using the latest EOS tag a
# and latest CTA commit to main
curl -X POST \
-F token=$CTA_TRIGGER_TOKEN \
-F ref=main \
-F "variables[TAG_NAME]=$EOS_TAG_NAME" \
-F "variables[XROOTD_VERSION]=$XROOTD_VERSION" \
$TRIGGER_URL
fi
when: manual
#only:
# - tags
rpm_commit_artifacts:
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
script:
- dnf install --nogpg -y sudo sssd-client createrepo
- if [[ -n "$CI_COMMIT_TAG" ]]; then echo "This only works for commits"; exit 0; else BUILD_TYPE="commit"; fi
- sudo -u stci -H ./gitlab-ci/store_artifacts.sh ${CODENAME} ${BUILD_TYPE} /eos/project/s/storage-ci/www/eos
tags:
- docker_node
- publish
except:
- tags
allow_failure: true
when: manual
rpm_testing_artifacts:
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
script:
- dnf install --nogpg -y sudo sssd-client createrepo
- if [[ -n "$CI_COMMIT_TAG" ]]; then BUILD_TYPE="tag/testing"; else BUILD_TYPE="commit"; fi
- sudo -u stci -H ./gitlab-ci/store_artifacts.sh ${CODENAME} ${BUILD_TYPE} /eos/project/s/storage-ci/www/eos
tags:
- docker_node
- publish
only:
- master
- tags
retry: 1
rpm_stable_artifacts:
stage: publish
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
script:
- dnf install --nogpg -y sudo sssd-client createrepo
- if [[ -n "$CI_COMMIT_TAG" ]]; then BUILD_TYPE="tag"; else echo "This only works for tags"; exit 0; fi
- ./gitlab-ci/store_artifacts.sh ${CODENAME} ${BUILD_TYPE} /mnt/eos_repositories/eos
- sudo -u stci -H ./gitlab-ci/store_stable_artifacts.sh ${CODENAME} /eos/project/s/storage-ci/www/eos ${CI_COMMIT_TAG}
- echo ${CI_COMMIT_TAG} | sudo -u stci tee /eos/project/s/storage-ci/www/eos/${CODENAME}/tag/latest_version
tags:
- docker_node
- publish
only:
- tags
dependencies: []
when: manual
#to be run after the rpm publish
.publish_dockerimage-template:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- if [[ -n "$CI_COMMIT_TAG" ]]; then
export REPOBRANCH="tag-testing";
export DESTINATION="${IMAGE_REPO}:${CI_COMMIT_TAG}${OS_TAG}";
else
export REPOBRANCH="commit";
export DESTINATION="${IMAGE_REPO}:${CI_COMMIT_SHORT_SHA}${OS_TAG}";
fi
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64)\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --cache=false --destination $DESTINATION --dockerfile $DOCKERFILE --context $CI_PROJECT_DIR --build-arg=EOS_CODENAME="${CODENAME}" --build-arg=REPOBRANCH="${REPOBRANCH}" --compressed-caching=false --use-new-run
retry: 1
el9_publish_dockerimage_all:
extends: .publish_dockerimage-template
variables:
DOCKERFILE: eos-docker/minimal/el9_minimal.Dockerfile
IMAGE_REPO: "gitlab-registry.cern.ch/dss/eos/eos-all"
OS_TAG: ".el9"
needs:
- job: clone_docker
- job: build_el9
allow_failure: true
when: manual
el9_publish_dockerimage_fusex:
extends: .publish_dockerimage-template
variables:
DOCKERFILE: eos-docker/minimal/el9_minimal.fusex-only.Dockerfile
IMAGE_REPO: "gitlab-registry.cern.ch/dss/eos/eos-fusex"
OS_TAG: ".el9"
needs:
- job: clone_docker
- job: build_el9