You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 160_gitlab_ci/000_rollout/exercise_project.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@ Your instance of Visual Studio Code is provisioned with your credentials to allo
9
9
10
10
## Task 2: Pulling from the upstream repository
11
11
12
-
XXX
12
+
The local clone of the `demo` project is configured with a remote pointing to the location of [the original project on GitHub](https://github.com/nicholasdille/container-slides). This is prepared in case the instructor needs to fix a demo. Let's test this safeguard:
13
13
14
14
1. Open a terminal
15
15
1. Change to the `demo` project directory
16
16
1. List remotes: `git remote -v`
17
-
1. Pull from the upstream repository: `git pull upstream --all`
17
+
1. Pull from the upstream repository: `git pull upstream`
The source for the slides as well as the demos are located in my repository called [container-slides](https://github.com/nicholasdille/container-slides)
50
-
51
-
Please refer to the release matching the date of your workshop
52
-
53
-
You should use the release tag to access the files in the repository
54
-
55
-
The hands-on chapters have a link to the exact directory in the repository
Copy file name to clipboardExpand all lines: 160_gitlab_ci/040_image/exercise.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -4,23 +4,23 @@
4
4
Learn how to...
5
5
6
6
- specify which container image to use for a job
7
-
- XXX
7
+
- tailor the execution environment to your needs
8
8
9
9
## Task: Simplify using container images
10
10
11
11
In the previous exampes, we called `apk` at the beginning of every job to install Go. This had to be repeated for every job because Go was not present. Choosing an image for a job using the `image` directive, time is saved by avoiding commands to install required tools. See the [official documentation](https://docs.gitlab.com/ee/ci/yaml/#image).
12
12
13
13
Replace the calls to `apk` with the container image `golang:1.19.2`.
14
14
15
-
XXX version bump for `golang` image
16
-
17
15
Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run.
Copy file name to clipboardExpand all lines: 160_gitlab_ci/050_defaults/exercise.md
+8-3
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@
3
3
!!! tip "Goal"
4
4
Learn how to...
5
5
6
-
- Avoid repetition in jobs
7
-
- Specify defaults are the top of your pipeline
6
+
- avoid repetition in jobs
7
+
- specify defaults are the top of your pipeline
8
8
9
9
## Task: Don't repeat yourself
10
10
@@ -19,6 +19,8 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
19
19
1. Add `default` with the `image` directive at the top
20
20
21
21
??? example "Solution (Click if you are stuck)"
22
+
`.gitlab-ci.yml`:
23
+
22
24
```yaml linenums="1" hl_lines="5-6"
23
25
stages:
24
26
- check
@@ -63,4 +65,7 @@ Jobs can still choose to use an image different from the default:
63
65
64
66
## Bonus 2: Default values for variables
65
67
66
-
XXX `variables` outside `default`
68
+
See the official documentation for [`default`](https://docs.gitlab.com/ee/ci/yaml/#default) as well as [`variables`](https://docs.gitlab.com/ee/ci/yaml/#variables) and check how they are related.
69
+
70
+
??? example "Solution (Click if you are stuck)"
71
+
Global variables are not located under `default` but under the global `variables` keyword.
Copy file name to clipboardExpand all lines: 160_gitlab_ci/060_artifacts/exercise.md
+11-3
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,8 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
31
31
```
32
32
33
33
??? example "Solution (Click if you are stuck)"
34
+
`.gitlab-ci.yml`:
35
+
34
36
```yaml linenums="1" hl_lines="4 27-35"
35
37
stages:
36
38
- check
@@ -75,11 +77,13 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
75
77
76
78
## Bonus 1: Define from which jobs to receive artifacts
77
79
78
-
Usually, artifacts are received from all job in the previous stages. Decide from which jobs to receive artifacts using the `dependencies`directive. See the [official documentation](https://docs.gitlab.com/ee/ci/yaml/#dependencies).
80
+
Usually, artifacts are received from all jobs in the previous stages. Decide from which jobs to receive artifacts using the `dependencies`keyword. See the [official documentation](https://docs.gitlab.com/ee/ci/yaml/#dependencies).
79
81
80
-
XXX
82
+
Modify the job `test` to consume artifacts only from the job `build`.
In some situations, artifacts are to heavy-weight and passing a variable would be enough. Read the documentation for [passing environment variables](https://docs.gitlab.com/ee/ci/variables/index.html#pass-an-environment-variable-to-another-job) and implement this between two jobs of your choice.
130
+
131
+
The following hint and solution are a working example.
126
132
127
133
??? info "Hint (Click if you are stuck)"
128
134
Example for creating an artifact for environment variables:
Copy file name to clipboardExpand all lines: 160_gitlab_ci/065_job_dependencies/exercise.md
+10-11
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,18 @@
3
3
!!! tip "Goal"
4
4
Learn how to...
5
5
6
-
- XXX
6
+
- ignore stages
7
+
- start jobs as soon as dependencies are met
7
8
8
-
## Task: Start the build job early
9
+
## Task: Start a job early
9
10
10
-
XXX start `build`after `audit` without waiting for `lint`
11
+
Start the job `build`as soon as the job `audit`completes without waiting for other job of the stage `check` to finish. Check out the official documentation of [`needs`](https://docs.gitlab.com/ee/ci/yaml/#needs).
11
12
12
13
Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run.
13
14
14
-
??? info "Hint (Click if you are stuck)"
15
-
XXX
16
-
17
15
??? example "Solution (Click if you are stuck)"
16
+
`.gitlab-ci.yml`:
17
+
18
18
```yaml linenums="1" hl_lines="21-22"
19
19
stages:
20
20
- check
@@ -57,16 +57,15 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
57
57
58
58
This was just a demonstration. The changes will not be preserved in the following chapters.
59
59
60
-
## Bonus: Start the lint job late
60
+
## Bonus: Start a job late
61
61
62
-
XXX start `lint`after `audit`
62
+
If two jobs in the same stage should not be executed at the same time, the [`needs`](https://docs.gitlab.com/ee/ci/yaml/#needs) keyword can also delay a job until the dependencies are met. Modify the job `lint`so that it waits for the job `audit` to finish.
63
63
64
64
Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run.
0 commit comments