Skip to content

Commit f03ca13

Browse files
committed
Final material for 20231207
1 parent 7014c1d commit f03ca13

File tree

14 files changed

+238
-192
lines changed

14 files changed

+238
-192
lines changed

160_gitlab_ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,5 @@ nav:
121121
- Caches: 265_caches/exercise.md
122122
- Renovate: 270_renovate/exercise.md
123123
- Security: 280_security/exercise.md
124+
- Wrap Up:
125+
- You are done: you_are_done.md

160_gitlab_ci/100_environments/exercise.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
7474
stage: check
7575
script:
7676
- go install gotest.tools/gotestsum@latest
77-
- gotestsum --junitfile report.xml --format testname
77+
- gotestsum --junitfile report.xml
7878
artifacts:
7979
when: always
8080
reports:
@@ -151,7 +151,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
151151
stage: check
152152
script:
153153
- go install gotest.tools/gotestsum@latest
154-
- gotestsum --junitfile report.xml --format testname
154+
- gotestsum --junitfile report.xml
155155
artifacts:
156156
when: always
157157
reports:
@@ -184,7 +184,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
184184
- apt-get -y install curl ca-certificates
185185
script:
186186
- |
187-
curl https://${CI_COMMIT_REF_NAME}.seat${SEAT_INDEX}.inmylab.de/ \
187+
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
188188
--fail \
189189
--verbose \
190190
--upload-file hello \

160_gitlab_ci/110_triggers/exercise.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Afterwards check the pipeline in both projects in the GitLab UI. You should see
7272
stage: check
7373
script:
7474
- go install gotest.tools/gotestsum@latest
75-
- gotestsum --junitfile report.xml --format testname
75+
- gotestsum --junitfile report.xml
7676
artifacts:
7777
when: always
7878
reports:
@@ -99,13 +99,13 @@ Afterwards check the pipeline in both projects in the GitLab UI. You should see
9999
deploy:
100100
stage: deploy
101101
environment:
102-
name: dev
102+
name: ${CI_COMMIT_REF_NAME}
103103
before_script:
104104
- apt-get update
105105
- apt-get -y install curl ca-certificates
106106
script:
107107
- |
108-
curl https://dev.seat${SEAT_INDEX}.inmylab.de/ \
108+
curl https://${CI_COMMIT_REF_NAME}.seat${SEAT_INDEX}.inmylab.de/ \
109109
--fail \
110110
--verbose \
111111
--upload-file hello \
@@ -167,7 +167,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
167167
stage: check
168168
script:
169169
- go install gotest.tools/gotestsum@latest
170-
- gotestsum --junitfile report.xml --format testname
170+
- gotestsum --junitfile report.xml
171171
artifacts:
172172
when: always
173173
reports:
@@ -194,13 +194,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
194194
deploy:
195195
stage: deploy
196196
environment:
197-
name: dev
197+
name: ${CI_COMMIT_REF_NAME}
198198
before_script:
199199
- apt-get update
200200
- apt-get -y install curl ca-certificates
201201
script:
202202
- |
203-
curl https://dev.seat${SEAT_INDEX}.inmylab.de/ \
203+
curl https://${CI_COMMIT_REF_NAME}.seat${SEAT_INDEX}.inmylab.de/ \
204204
--fail \
205205
--verbose \
206206
--upload-file hello \
@@ -266,7 +266,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
266266
stage: check
267267
script:
268268
- go install gotest.tools/gotestsum@latest
269-
- gotestsum --junitfile report.xml --format testname
269+
- gotestsum --junitfile report.xml
270270
artifacts:
271271
when: always
272272
reports:
@@ -293,18 +293,18 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
293293
deploy:
294294
stage: deploy
295295
environment:
296-
name: dev
296+
name: ${CI_COMMIT_REF_NAME}
297297
before_script:
298298
- apt-get update
299299
- apt-get -y install curl ca-certificates
300300
script:
301301
- |
302-
curl https://seat${SEAT_INDEX}.dev.webdav.inmylab.de/ \
302+
curl https://${CI_COMMIT_REF_NAME}.seat${SEAT_INDEX}.inmylab.de/ \
303303
--fail \
304304
--verbose \
305305
--upload-file hello \
306306
--user seat${SEAT_INDEX}:${PASS}
307-
307+
308308
trigger:
309309
stage: trigger
310310
trigger:

160_gitlab_ci/120_templates/exercise.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
5353
stage: check
5454
script:
5555
- go install gotest.tools/gotestsum@latest
56-
- gotestsum --junitfile report.xml --format testname
56+
- gotestsum --junitfile report.xml
5757
artifacts:
5858
when: always
5959
reports:
@@ -84,18 +84,18 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
8484
deploy:
8585
stage: deploy
8686
environment:
87-
name: dev
87+
name: ${CI_COMMIT_REF_NAME}
8888
before_script:
8989
- apt-get update
9090
- apt-get -y install curl ca-certificates
9191
script:
9292
- |
93-
curl https://seat${SEAT_INDEX}.dev.webdav.inmylab.de/ \
93+
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
9494
--fail \
9595
--verbose \
9696
--upload-file hello \
9797
--user seat${SEAT_INDEX}:${PASS}
98-
98+
9999
trigger:
100100
stage: trigger
101101
trigger:
@@ -172,7 +172,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
172172
stage: check
173173
script:
174174
- go install gotest.tools/gotestsum@latest
175-
- gotestsum --junitfile report.xml --format testname
175+
- gotestsum --junitfile report.xml
176176
artifacts:
177177
when: always
178178
reports:
@@ -195,18 +195,18 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
195195
deploy:
196196
stage: deploy
197197
environment:
198-
name: dev
198+
name: ${CI_COMMIT_REF_NAME}
199199
before_script:
200200
- apt-get update
201201
- apt-get -y install curl ca-certificates
202202
script:
203203
- |
204-
curl https://seat${SEAT_INDEX}.dev.webdav.inmylab.de/ \
204+
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
205205
--fail \
206206
--verbose \
207207
--upload-file hello \
208208
--user seat${SEAT_INDEX}:${PASS}
209-
209+
210210
trigger:
211211
stage: trigger
212212
trigger:

160_gitlab_ci/130_rules/exercise.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
4747
??? example "Solution (Click if you are stuck)"
4848
`.gitlab-ci.yml`:
4949

50-
```yaml linenums="1" hl_lines="63-71"
50+
```yaml linenums="1" hl_lines="63-72"
5151
include:
5252
- local: go.yaml
5353
@@ -75,7 +75,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
7575
stage: check
7676
script:
7777
- go install gotest.tools/gotestsum@latest
78-
- gotestsum --junitfile report.xml --format testname
78+
- gotestsum --junitfile report.xml
7979
artifacts:
8080
when: always
8181
reports:
@@ -98,13 +98,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
9898
deploy:
9999
stage: deploy
100100
environment:
101-
name: dev
101+
name: ${CI_COMMIT_REF_NAME}
102102
before_script:
103103
- apt-get update
104104
- apt-get -y install curl ca-certificates
105105
script:
106106
- |
107-
curl https://seat${SEAT_INDEX}.dev.webdav.inmylab.de/ \
107+
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
108108
--fail \
109109
--verbose \
110110
--upload-file hello \
@@ -116,11 +116,11 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
116116
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
117117
image: alpine
118118
script:
119-
- cp hello public/
119+
- cp hello public
120120
artifacts:
121121
paths:
122122
- public
123-
123+
124124
trigger:
125125
stage: trigger
126126
trigger:
@@ -191,7 +191,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
191191
stage: check
192192
script:
193193
- go install gotest.tools/gotestsum@latest
194-
- gotestsum --junitfile report.xml --format testname
194+
- gotestsum --junitfile report.xml
195195
artifacts:
196196
when: always
197197
reports:
@@ -236,7 +236,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
236236
artifacts:
237237
paths:
238238
- public
239-
239+
240240
trigger:
241241
stage: trigger
242242
trigger:
@@ -308,7 +308,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
308308
stage: check
309309
script:
310310
- go install gotest.tools/gotestsum@latest
311-
- gotestsum --junitfile report.xml --format testname
311+
- gotestsum --junitfile report.xml
312312
artifacts:
313313
when: always
314314
reports:
@@ -353,7 +353,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
353353
artifacts:
354354
paths:
355355
- public
356-
356+
357357
trigger:
358358
stage: trigger
359359
trigger:

160_gitlab_ci/140_merge_requests/exercise.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
2424
`$CI_PIPELINE_SOURCE` can take the values `push` and `merge_request_event` in this context. `$CI_COMMIT_REF_NAME` contains the name of the Git reference (e.g. branch) the pipeline is running on. `$CI_DEFAULT_BRANCH` contains the name of the default branch of the repository in the current project. You can use the logical operator `&&` to combine multiple conditions.
2525

2626
??? example "Solution (Click if you are stuck)"
27-
```yaml linenums="1" hl_lines="30-32 38-40 46-48 59-61 70-72 79-80 106-107"
27+
```yaml linenums="1" hl_lines="30-32 38-40 46-48 59-61 70-72 79-80 107-108"
2828
workflow:
2929
rules:
3030
- if: $CI_DEPLOY_FREEZE
@@ -75,7 +75,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
7575
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
7676
script:
7777
- go install gotest.tools/gotestsum@latest
78-
- gotestsum --junitfile report.xml --format testname
78+
- gotestsum --junitfile report.xml
7979
artifacts:
8080
when: always
8181
reports:
@@ -106,13 +106,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
106106
rules:
107107
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
108108
environment:
109-
name: dev
109+
name: ${CI_COMMIT_REF_NAME}
110110
before_script:
111111
- apt-get update
112112
- apt-get -y install curl ca-certificates
113113
script:
114114
- |
115-
curl https://seat${SEAT_INDEX}.dev.webdav.inmylab.de/ \
115+
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
116116
--fail \
117117
--verbose \
118118
--upload-file hello \
@@ -122,12 +122,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
122122
stage: deploy
123123
rules:
124124
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
125+
image: alpine
125126
script:
126127
- cp hello public/
127128
artifacts:
128129
paths:
129130
- public
130-
131+
131132
trigger:
132133
stage: trigger
133134
rules:
@@ -171,7 +172,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
171172
Remember that only `variables` are kumulative. All other keywords overwrite each other in the order of appearance.
172173

173174
??? example "Solution (Click if you are stuck)"
174-
```yaml linenums="1" hl_lines="18-25 39-40 46-47 53-55 65-66 75-76 83-84 100-101 110-111"
175+
```yaml linenums="1" hl_lines="18-25 39-40 46-47 53-54 65-66 74-75 82-83 99-100 110-111"
175176
workflow:
176177
rules:
177178
- if: $CI_DEPLOY_FREEZE
@@ -228,7 +229,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
228229
- .run-on-push-and-in-mr
229230
script:
230231
- go install gotest.tools/gotestsum@latest
231-
- gotestsum --junitfile report.xml --format testname
232+
- gotestsum --junitfile report.xml
232233
artifacts:
233234
when: always
234235
reports:
@@ -256,13 +257,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
256257
extends:
257258
- .run-on-push-to-default-branch
258259
environment:
259-
name: dev
260+
name: ${CI_COMMIT_REF_NAME}
260261
before_script:
261262
- apt-get update
262263
- apt-get -y install curl ca-certificates
263264
script:
264265
- |
265-
curl https://seat${SEAT_INDEX}.dev.webdav.inmylab.de/ \
266+
curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME}.webdav.inmylab.de/ \
266267
--fail \
267268
--verbose \
268269
--upload-file hello \
@@ -272,12 +273,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
272273
stage: deploy
273274
extends:
274275
- .run-on-push-to-default-branch
276+
image: alpine
275277
script:
276278
- cp hello public/
277279
artifacts:
278280
paths:
279281
- public
280-
282+
281283
trigger:
282284
stage: trigger
283285
extends:

0 commit comments

Comments
 (0)