forked from PocketCoffea/PocketCoffea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
152 lines (125 loc) · 4.63 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
stages:
- build
- test
- tag
- publish
include:
- project: 'cms-analysis/general/container-image-ci-templates'
file:
- 'kaniko-image.gitlab-ci.yml'
- 'skopeo.gitlab-ci.yml'
variables:
CONTEXT_DIR: ""
DOCKER_FILE_NAME: "Dockerfile"
GIT_SUBMODULE_STRATEGY: recursive
PUSH_IMAGE: "true"
ACCELERATED_IMAGE: "true"
BUILD_ARGS: ""
SCAN_IMAGE: "false"
.build_docker_template:
extends: .build_kaniko
only:
- pushes
- merge_requests
- coffea_2023
- main
- stable
#--------------------------------------------------------------------
# Build images and tag with short commit SHA
# build_docker_lxplus_cc7:
# extends: .build_docker_template
# variables:
# BUILD_ARGS: "FROM_IMAGE=gitlab-registry.cern.ch/batch-team/dask-lxplus/lxdask-cc7:latest CLUSTER=lxplus-cc7"
# REGISTRY_IMAGE_PATH: ${CI_REGISTRY_IMAGE}:lxplus-cc7-${CI_COMMIT_SHORT_SHA}
build_docker_lxplus_el9:
extends: .build_docker_template
variables:
BUILD_ARGS: "FROM_IMAGE=gitlab-registry.cern.ch/batch-team/dask-lxplus/lxdask-al9:latest CLUSTER=lxplus-el9"
REGISTRY_IMAGE_PATH: ${CI_REGISTRY_IMAGE}:lxplus-el9-${CI_COMMIT_SHORT_SHA}
#--------------------------------------------------------------------
# Tag images on default branch as latest
# build_docker_lxplus_cc7_latest:
# extends: .tag_skopeo
# rules:
# - if: '$CI_COMMIT_REF_NAME == "main"'
# variables:
# IMAGE_ORIGIN_TAG: ${CI_REGISTRY_IMAGE}:lxplus-cc7-${CI_COMMIT_SHORT_SHA}
# IMAGE_DESTINATION_TAG: ${CI_REGISTRY_IMAGE}:lxplus-cc7-latest
build_docker_lxplus_el9_latest:
extends: .tag_skopeo
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
variables:
IMAGE_ORIGIN_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-${CI_COMMIT_SHORT_SHA}
IMAGE_DESTINATION_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-latest
#-----------------------------
# Tag images on stable branch
# build_docker_lxplus_cc7_stable:
# extends: .tag_skopeo
# rules:
# - if: '$CI_COMMIT_REF_NAME == "stable"'
# variables:
# IMAGE_ORIGIN_TAG: ${CI_REGISTRY_IMAGE}:lxplus-cc7-${CI_COMMIT_SHORT_SHA}
# IMAGE_DESTINATION_TAG: ${CI_REGISTRY_IMAGE}:lxplus-cc7-stable
build_docker_lxplus_el9_stable:
extends: .tag_skopeo
rules:
- if: '$CI_COMMIT_REF_NAME == "stable"'
variables:
IMAGE_ORIGIN_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-${CI_COMMIT_SHORT_SHA}
IMAGE_DESTINATION_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-stable
#----------------------------------
# Run tests
# tests_lxplus_el9_latest:
# stage: test
# id_tokens:
# MY_JOB_JWT: # this is needed, it specifies the aud from which the proxy is requested.
# aud: "cms-cat-ci-datasets.app.cern.ch"
# tags:
# - cvmfs
# image:
# name: "gitlab-registry.cern.ch/cms-analysis/general/pocketcoffea:lxplus-el9-${CI_COMMIT_SHORT_SHA}"
# variables:
# EOSPATH: '/eos/cms/store/group/cat/datasets/NANOAOD/Run2017F-UL2017_MiniAODv2_NanoAODv9-v1/SingleElectron/C68E8C0B-CAE8-D14A-B007-DEC00B15B35C.root'
# EOS_MGM_URL: root://eoscms.cern.ch
# before_script:
# - 'XrdSecsssENDORSEMENT=$(curl --fail-with-body -H "Authorization: ${MY_JOB_JWT}" "https://cms-cat-ci-datasets.app.cern.ch/api?eospath=${EOSPATH}" | tr -d \")'
# script:
# - pip install pytest>=6
# - pytest tests
tests_lxplus_el9_latest:
stage: test
id_tokens:
MY_JOB_JWT: # this is needed, it specifies the aud from which the proxy is requested.
aud: "cms-cat-grid-proxy-service.app.cern.ch"
tags:
- cvmfs
image:
name: "gitlab-registry.cern.ch/cms-analysis/general/pocketcoffea:lxplus-el9-${CI_COMMIT_SHORT_SHA}"
before_script:
- 'proxy=$(curl --fail-with-body -H "Authorization: ${MY_JOB_JWT}" "https://cms-cat-grid-proxy-service.app.cern.ch/api" | tr -d \")'
script:
- printf $proxy | base64 -d > myproxy
- export X509_USER_PROXY=$(pwd)/myproxy
- export X509_CERT_DIR=/cvmfs/grid.cern.ch/etc/grid-security/certificates/
- voms-proxy-info # to test it
- pip install pytest>=6
- pytest tests
#----------------------------------
# Tag images on coffea2023 branch
build_docker_lxplus_coffea2023:
extends: .tag_skopeo
rules:
- if: '$CI_COMMIT_REF_NAME == "coffea_2023"'
variables:
IMAGE_ORIGIN_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-${CI_COMMIT_SHORT_SHA}
IMAGE_DESTINATION_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-coffea2023
#-------------------------------------------------------------------
# Tag images using git tag
build_docker_lxplus_tagged:
extends: .tag_skopeo
rules:
- if: $CI_COMMIT_TAG
variables:
IMAGE_ORIGIN_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-${CI_COMMIT_SHORT_SHA}
IMAGE_DESTINATION_TAG: ${CI_REGISTRY_IMAGE}:lxplus-el9-${CI_COMMIT_TAG}