-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
191 lines (174 loc) · 5.74 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
stages:
- build
- test
- push
- deploy
include:
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'variables.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'defaults/dind.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'build/build-container-with-cache.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'security/security.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'security/security-container.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'push/push-container-gitlab.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'push/push-signed-container-harbor.yml'
- project: 'ULB/it-service/base-images/ci-template'
ref: 'main'
file: 'pipelines/helm-charts.yml'
variables:
HELM_CHART_NAME: "metadata-extraktor"
HELM_BUILD_DIR: "$CI_PROJECT_DIR/build"
.default_rules:
rules:
- when: always
.default_rules_prod:
rules:
- if: $CI_COMMIT_BRANCH != "prod"
when: never
- !reference [.default_rules, rules]
test:
image:
name: "$CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/perl:5.36-bullseye"
script:
- apt update
- apt install -y poppler-utils
- cpanm -nq --installdeps .
- perl Makefile.PL
- make test
build-container-with-cache:
variables:
CI_DOCKERFILE_PATH: "./"
rules:
- !reference [.default_rules, rules]
container_scanning:
needs:
- build-container-with-cache
rules:
- !reference [.default_rules, rules]
push-container-gitlab:
needs:
- test
- container_scanning
- kics-iac-sast
- secret_detection
rules:
- !reference [.default_rules, rules]
push-container-harbor:
needs:
- test
- container_scanning
- kics-iac-sast
- secret_detection
rules:
- !reference [.default_rules, rules]
prepare-for-signing:
rules:
- !reference [.default_rules, rules]
sign-container-harbor:
needs:
- push-container-harbor
rules:
- !reference [.default_rules, rules]
helm build:
rules:
- changes:
- metadata-extraktor/../.
helm push:
rules:
- changes:
- metadata-extraktor/../.
staging dry-run:
stage: deploy
needs:
- sign-container-harbor
- helm lint
environment:
name: staging
url: https://scdh-services-staging.uni-muenster.de
variables:
KUBE_CONTEXT: SCDH/ag-3d/metadata-extraktor:scdh-universe-stage
rules:
- !reference [.default_rules, rules]
before_script:
- echo "$HARBOR_PASSWORD" | helm registry login "${HARBOR_URL}" --username "${HARBOR_USERNAME}" --password-stdin
- kubectl config use-context $KUBE_CONTEXT && chmod 0400 $KUBECONFIG
script:
- helm dependency update metadata-extraktor
- helm upgrade --install metadata-extraktor ./metadata-extraktor -n=scdh-universe -f installs/stage-scdh-universe.yaml --set image.imageCredentials.username=$HARBOR_USERNAME --set image.imageCredentials.password=$HARBOR_PASSWORD --dry-run > /dev/null
after_script:
- helm registry logout "${HARBOR_URL}"
staging deploy:
stage: deploy
needs:
- sign-container-harbor
- helm lint
- staging dry-run
environment:
name: staging
url: https://scdh-services-staging.uni-muenster.de
variables:
KUBE_CONTEXT: SCDH/ag-3d/metadata-extraktor:scdh-universe-stage
rules:
- !reference [.default_rules, rules]
before_script:
- echo "$HARBOR_PASSWORD" | helm registry login "${HARBOR_URL}" --username "${HARBOR_USERNAME}" --password-stdin
- kubectl config use-context $KUBE_CONTEXT && chmod 0400 $KUBECONFIG
script:
- helm dependency update metadata-extraktor
- helm upgrade --install metadata-extraktor metadata-extraktor/ -n=scdh-universe -f installs/stage-scdh-universe.yaml --set image.imageCredentials.username=$HARBOR_USERNAME --set image.imageCredentials.password=$HARBOR_PASSWORD > /dev/null
after_script:
- helm registry logout "${HARBOR_URL}"
production dry-run:
stage: deploy
needs:
- sign-container-harbor
- helm lint
environment:
name: production
url: https://ag3d-metadata-extraktor.uni-muenster.de
variables:
KUBE_CONTEXT: SCDH/ag-3d/metadata-extraktor:scdh-universe-prod
rules:
- !reference [.default_rules_prod, rules]
before_script:
- echo "$HARBOR_PASSWORD" | helm registry login "${HARBOR_URL}" --username "${HARBOR_USERNAME}" --password-stdin
- kubectl config use-context $KUBE_CONTEXT && chmod 0400 $KUBECONFIG
script:
- helm dependency update metadata-extraktor
- helm upgrade --install metadata-extraktor metadata-extraktor/ -n=scdh-universe -f installs/stage-scdh-universe.yaml --set image.imageCredentials.username=$HARBOR_USERNAME --set image.imageCredentials.password=$HARBOR_PASSWORD --dry-run > /dev/null
after_script:
- helm registry logout "${HARBOR_URL}"
production deploy:
stage: deploy
needs:
- sign-container-harbor
- helm lint
- production dry-run
environment:
name: production
url: https://ag3d-metadata-extraktor.uni-muenster.de
variables:
KUBE_CONTEXT: SCDH/ag-3d/metadata-extraktor:scdh-universe-prod
rules:
- !reference [.default_rules_prod, rules]
before_script:
- echo "$HARBOR_PASSWORD" | helm registry login "${HARBOR_URL}" --username "${HARBOR_USERNAME}" --password-stdin
- kubectl config use-context $KUBE_CONTEXT && chmod 0400 $KUBECONFIG
script:
- helm dependency update metadata-extraktor
- helm upgrade --install metadata-extraktor metadata-extraktor/ -n=scdh-universe -f installs/prod-scdh-universe.yaml --set image.imageCredentials.username=$HARBOR_USERNAME --set image.imageCredentials.password=$HARBOR_PASSWORD > /dev/null
after_script:
- helm registry logout "${HARBOR_URL}"