-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
236 lines (220 loc) · 6.42 KB
/
.gitlab-ci.yml
File metadata and controls
236 lines (220 loc) · 6.42 KB
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
stages:
- PreBuild
- Generate
- Build
- Deploy
default:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
variables:
KUBE_CONTEXT: "uitsmijter/shared-agent:pawpatrol"
GIT_SUBMODULE_STRATEGY: recursive
IMAGE_TAG: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}
HUGO_TAG: ${CI_REGISTRY_IMAGE}:_hugo
SASS_TAG: ${CI_REGISTRY_IMAGE}:_sass
WOFF_TAG: ${CI_REGISTRY_IMAGE}:_woff
.use_context: &use_context
- kubectl config get-contexts
- kubectl config use-context "$KUBE_CONTEXT"
# ------------------------------------------------------------
# PreBuild
# ------------------------------------------------------------
Build-Sass:
stage: PreBuild
script:
- mkdir -p /kaniko/.docker
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/deployment/sass.dockerfile"
--tarPath sass-image.tar --destination=${SASS_TAG} --no-push
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
artifacts:
paths:
- sass-image.tar
when: on_success
expire_in: 1 hours
Build-Woff:
stage: PreBuild
script:
- mkdir -p /kaniko/.docker
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/deployment/woff.dockerfile"
--tarPath woff-image.tar --destination=${WOFF_TAG} --no-push
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
artifacts:
paths:
- woff-image.tar
when: on_success
expire_in: 1 hours
Build-Hugo:
stage: PreBuild
script:
- mkdir -p /kaniko/.docker
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/deployment/hugo.dockerfile"
--tarPath hugo-image.tar --destination=${HUGO_TAG} --no-push
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
artifacts:
paths:
- hugo-image.tar
when: on_success
expire_in: 1 hours
Publish-Sass:
stage: PreBuild
needs:
- Build-Sass
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [ "" ]
script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- crane push sass-image.tar ${SASS_TAG}
Publish-Woff:
stage: PreBuild
needs:
- Build-Woff
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [ "" ]
script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- crane push woff-image.tar ${WOFF_TAG}
Publish-Hugo:
stage: PreBuild
needs:
- Build-Hugo
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [ "" ]
script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- crane push hugo-image.tar ${HUGO_TAG}
# ------------------------------------------------------------
# Generate
# ------------------------------------------------------------
Generate-CSS:
stage: Generate
image:
name: ${SASS_TAG}
entrypoint: [ "" ]
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
script:
- mkdir -p ./public
- for SASS_SOURCE in main mobile print; do
sass ./resources/sass/${SASS_SOURCE}.scss ./resources/${SASS_SOURCE}.css;
mv ./resources/${SASS_SOURCE}.{css,css.map} ./public;
done
artifacts:
paths:
- public
when: on_success
expire_in: 1 hours
Generate-Woff:
stage: Generate
image:
name: ${WOFF_TAG}
entrypoint: [ "" ]
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
script:
- mkdir -p ./public
- cd /
- for TTF in $(ls ./themes/uitsmijter/static/fonts/{Bebas_Neue,Inconsolata,Inconsolata/**,Source_Sans_Pro}/*.ttf); do
./convert.sh ${TTF};
done
artifacts:
paths:
- public
when: on_success
expire_in: 1 hours
Generate-Site:
stage: Generate
needs:
- Generate-CSS
- Generate-Woff
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
image:
name: ${HUGO_TAG}
entrypoint: [ "" ]
script:
- hugo
artifacts:
paths:
- public
when: on_success
expire_in: 1 hours
# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
Build-Webserver:
stage: Build
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
script:
- mkdir -p /kaniko/.docker
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/deployment/nginx.dockerfile"
--tarPath docs-image.tar --destination=${IMAGE_TAG} --no-push
artifacts:
paths:
- docs-image.tar
when: on_success
expire_in: 1 hours
Publish-Webserver:
stage: Build
needs:
- Build-Webserver
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [ "" ]
script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- crane push docs-image.tar ${IMAGE_TAG}
# ------------------------------------------------------------
# Deploy
# ------------------------------------------------------------
Deploy-Release:
stage: Deploy
image: ausdertechnik/buildbot-margarete@sha256:9127b6b2a5cd54400727be4c54f41c9fcee312488315fe7327e8aa725589bdb4
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
script:
- *use_context
- pushd deployment/kustomize/base
- kustomize edit set image uitsmijter/documentation=${IMAGE_TAG};
- popd
- kubectl create ns "uitsmijter-docs" || true
- kubectl label --overwrite namespace uitsmijter-docs uitsmijter.io/cert-sync=true
- kubectl apply -n "uitsmijter-docs" -f ${PAWPATROL_PULLSECRET}
- kubectl apply -k deployment/kustomize/overlays/production
Deploy-Main:
stage: Deploy
image: ausdertechnik/buildbot-margarete@sha256:9127b6b2a5cd54400727be4c54f41c9fcee312488315fe7327e8aa725589bdb4
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- *use_context
- pushd deployment/kustomize/base
- kustomize edit set image uitsmijter/documentation=ghcr.io/uitsmijter/documentation:latest;
- popd
- kubectl create ns "uitsmijter-docs" || true
- kubectl label --overwrite namespace uitsmijter-docs uitsmijter.io/cert-sync=true
- kubectl apply -n "uitsmijter-docs" -f ${PAWPATROL_PULLSECRET}
- kubectl apply -k deployment/kustomize/overlays/production