@@ -24,7 +24,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
24
24
` $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.
25
25
26
26
??? 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 "
28
28
workflow:
29
29
rules:
30
30
- if: $CI_DEPLOY_FREEZE
@@ -75,7 +75,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
75
75
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
76
76
script:
77
77
- go install gotest.tools/gotestsum@latest
78
- - gotestsum --junitfile report.xml --format testname
78
+ - gotestsum --junitfile report.xml
79
79
artifacts:
80
80
when: always
81
81
reports:
@@ -106,13 +106,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
106
106
rules:
107
107
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
108
108
environment:
109
- name: dev
109
+ name: ${CI_COMMIT_REF_NAME}
110
110
before_script:
111
111
- apt-get update
112
112
- apt-get -y install curl ca-certificates
113
113
script:
114
114
- |
115
- curl https://seat${SEAT_INDEX}.dev .webdav.inmylab.de/ \
115
+ curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME} .webdav.inmylab.de/ \
116
116
--fail \
117
117
--verbose \
118
118
--upload-file hello \
@@ -122,12 +122,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
122
122
stage: deploy
123
123
rules:
124
124
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
125
+ image: alpine
125
126
script:
126
127
- cp hello public/
127
128
artifacts:
128
129
paths:
129
130
- public
130
-
131
+
131
132
trigger:
132
133
stage: trigger
133
134
rules:
@@ -171,7 +172,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
171
172
Remember that only `variables` are kumulative. All other keywords overwrite each other in the order of appearance.
172
173
173
174
??? 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"
175
176
workflow:
176
177
rules:
177
178
- if: $CI_DEPLOY_FREEZE
@@ -228,7 +229,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
228
229
- .run-on-push-and-in-mr
229
230
script:
230
231
- go install gotest.tools/gotestsum@latest
231
- - gotestsum --junitfile report.xml --format testname
232
+ - gotestsum --junitfile report.xml
232
233
artifacts:
233
234
when: always
234
235
reports:
@@ -256,13 +257,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
256
257
extends:
257
258
- .run-on-push-to-default-branch
258
259
environment:
259
- name: dev
260
+ name: ${CI_COMMIT_REF_NAME}
260
261
before_script:
261
262
- apt-get update
262
263
- apt-get -y install curl ca-certificates
263
264
script:
264
265
- |
265
- curl https://seat${SEAT_INDEX}.dev .webdav.inmylab.de/ \
266
+ curl https://seat${SEAT_INDEX}.${CI_COMMIT_REF_NAME} .webdav.inmylab.de/ \
266
267
--fail \
267
268
--verbose \
268
269
--upload-file hello \
@@ -272,12 +273,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
272
273
stage: deploy
273
274
extends:
274
275
- .run-on-push-to-default-branch
276
+ image: alpine
275
277
script:
276
278
- cp hello public/
277
279
artifacts:
278
280
paths:
279
281
- public
280
-
282
+
281
283
trigger:
282
284
stage: trigger
283
285
extends:
0 commit comments