Skip to content

Commit 27f4a84

Browse files
committed
Updates after day 2 of 20250514
1 parent 12b1507 commit 27f4a84

File tree

20 files changed

+259
-92
lines changed

20 files changed

+259
-92
lines changed

160_gitlab_ci/095_scheduling_internals/slides.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@
88

99
## Scheduling Internals
1010

11-
XXX create in DB and enqueue
11+
How GitLab manages pipelines:
1212

13-
XXX metrics
13+
1. Receive a trigger event
14+
1. Determine which jobs to run
15+
1. Create pipeline, stages and jobs in database
16+
1. Enqueue jobs if prerequisites are met
17+
- All upstream jobs are done
18+
- The seletected runner is available
19+
1. GitLab Runner picks up the job
20+
1. The log is streamed to GitLab
21+
1. After completion, GitLab Runner sends the result back to GitLab
22+
23+
Meanwhile the database is continuously updated with the status
24+
25+
---
26+
27+
## Job metrics
28+
29+
GitLab comes with Prometheus metrics:
30+
31+
`ci_pending_builds` - number of jobs waiting to be picked up
32+
33+
`ci_running_builds` - number of jobs currently running
34+
35+
`gitlab_ci_job_failure_reasons` - reasons for job failures
36+
37+
`job_queue_duration_seconds` - histogram data for the time spent in the queue

160_gitlab_ci/097_manual_pipelines/slides.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,41 @@
88

99
## Manual Pipelines
1010

11-
XXX [](https://docs.gitlab.com/ci/pipelines/#prefill-variables-in-manual-pipelines)
11+
<i class="fa-duotone fa-solid fa-4x fa-light-switch-on"></i> <!-- .element: style="float: right;" -->
1212

13-
XXX `variables:description` [](https://docs.gitlab.com/ci/yaml/#variablesdescription)
13+
Manual trigger from the pipeline overview in the web UI
1414

15-
XXX `variables:value` [](https://docs.gitlab.com/ci/yaml/#variablesvalue)
15+
Pipeline variables can be added manually
1616

17-
XXX `variables:options` [](https://docs.gitlab.com/ci/yaml/#variablesoptions)
17+
But simple forms are also possible [](https://docs.gitlab.com/ci/pipelines/#prefill-variables-in-manual-pipelines)
18+
19+
Global variables can have...
20+
21+
- Description in `variables:description` [](https://docs.gitlab.com/ci/yaml/#variablesdescription)
22+
- Default value in `variables:value` [](https://docs.gitlab.com/ci/yaml/#variablesvalue)
23+
- Dropdown options in `variables:options` [](https://docs.gitlab.com/ci/yaml/#variablesoptions)
24+
25+
### See also
26+
27+
Pipeline inputs in a later chapter [<i class="fa-solid fa-arrow-right-to-bracket"></i>](#/gitlab_ci_inputs)
28+
29+
---
30+
31+
## Example
32+
33+
Use global variables for basic forms:
34+
35+
```yaml
36+
variables:
37+
favorite_fruit:
38+
description: "My favorite fruit"
39+
value: apple
40+
options:
41+
- apple
42+
- banana
43+
- strawberry
44+
45+
job_name:
46+
script: |
47+
echo "My favorite fruit is $favorite_fruit"
48+
```

160_gitlab_ci/120_templates/slides.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ job_name:
151151
script: whoami
152152
```
153153

154-
But `variables` are merged!
155-
156154
---
157155

158156
## Pro tip 2: Solve multiple inheritence
@@ -175,6 +173,8 @@ job_name:
175173
- !reference[.template2, script]
176174
```
177175

176+
CI/CD Components are a proper solution in a later chapter [<i class="fa-solid fa-arrow-right-to-bracket"></i>](#/gitlab_components)
177+
178178
---
179179

180180
## Pro tip 3: Organizing templates in repositories
@@ -197,8 +197,6 @@ Separation of concerns
197197

198198
Harder to find/browse, easier to version
199199

200-
Create versions separately
201-
202200
---
203201

204202
## Pro tip 4: Public Template Library

160_gitlab_ci/130_rules/exercise.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pages:
3131
- public
3232
```
3333
34-
Review the official documentation for the [`rules`](https://docs.gitlab.com/ee/ci/yaml/#rules) keyword to limit the job `pages` to run when...
34+
Review the official documentation for the [`rules`](https://docs.gitlab.com/ee/ci/yaml/#rules) keyword and the [predefined variables](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) to limit the job `pages` to run when...
3535

3636
- the pipeline was triggered by a push event AND
3737
- the change applied to the default branch

160_gitlab_ci/130_rules/slides.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ job_name:
2020
#...
2121
```
2222

23+
If no condition matches, the job disappears from the pipeline
24+
2325
Formerly `only`/`except` [](https://docs.gitlab.com/ee/ci/yaml/#only--except) which are "not actively developed"
2426

2527
Official documentation of job control [](https://docs.gitlab.com/ee/ci/jobs/job_control.html)
@@ -51,16 +53,18 @@ Disable execution for some trigger types
5153
```yaml
5254
workflow:
5355
rules:
54-
- if: $CI_PIPELINE_SOURCE == 'push'
55-
- if: $CI_PIPELINE_SOURCE == 'web'
56-
- if: $CI_PIPELINE_SOURCE == 'schedule'
57-
- if: $CI_PIPELINE_SOURCE == 'pipeline'
58-
- if: $CI_PIPELINE_SOURCE == 'api'
56+
- if: $CI_PIPELINE_SOURCE == 'push' # Allow triggering through git push
57+
- if: $CI_PIPELINE_SOURCE == 'web' # Allow manally triggered pipelines
58+
- if: $CI_PIPELINE_SOURCE == 'schedule' # Allow scheduled pipelines
59+
- if: $CI_PIPELINE_SOURCE == 'pipeline' # Allow multi-project pipelines
60+
- if: $CI_PIPELINE_SOURCE == 'api' # Prevent pipelines triggered through the API
5961
when: never
60-
- if: $CI_PIPELINE_SOURCE == 'trigger'
62+
- if: $CI_PIPELINE_SOURCE == 'trigger' # Prevent pipelines triggered through trigger tokens
6163
when: never
6264
```
6365
66+
See the pre-defined variables [](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) for more information about the variables
67+
6468
---
6569
6670
## Mind the order
@@ -122,7 +126,7 @@ Rules not only control execution of jobs but can also configure jobs through the
122126

123127
Rules become especially powerful when combining the fields supported by rules - including `if`
124128

125-
--
129+
---
126130

127131
## Pro tip 3: Avoid pipeline on push
128132

@@ -139,6 +143,8 @@ my_job:
139143
when: never
140144
```
141145

146+
See the pre-defined variables [](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) for more information about the variables
147+
142148
---
143149

144150
## Pro tip 4: Use quotes to help the YAML parser
@@ -190,4 +196,4 @@ Situation:
190196

191197
Possible root cause:
192198

193-
- All job were filtered out due to rules
199+
- All jobs were filtered out due to rules

160_gitlab_ci/140_merge_requests/exercise.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ In the last chapter about `rules`, you learned how to use `$CI_PIPELINE_SOURCE`
1212

1313
On the branch `main`, add rules to the jobs to specify when to run them:
1414

15-
1. For the jobs `lint`, `audit`, `unit_tests`, `build` and `test`, add rules so that the jobs are executed when...
15+
1. Add rules the jobs `lint`, `audit`, `unit_tests`, `build` and `test` so that they are executed when...
1616
1. pushing to the default branch
1717
1. running in merge request context
1818
1. Run the job `trigger` only when pushing to the default branch
1919
1. Run the job `deploy` only when on the branches `dev` and `live`
2020
1. Do not modify the existing rules for the job `pages`
2121

22+
Also add the merge request event to the workflow rules to allow the pipeline to run in merge request context.
23+
2224
Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run.
2325

2426
??? info "Hint (Click if you are stuck)"
@@ -147,6 +149,7 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
147149
Now we want to check which jobs are executed in the context of a merge request:
148150

149151
1. Create a new branch based on `main`
152+
1. Push a change to the new branch, e.g. small change to the `README.md` file
150153
1. Create a merge request into `main`
151154

152155
Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run.

160_gitlab_ci/160_variable_precedence/slides.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Variable precedence
1010

11-
Variables con be defined on many different levels
11+
Variables can be defined on many different levels
1212

1313
GitLab has documented the precedence of variables [](https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence)
1414

160_gitlab_ci/170_deprecations/slides.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@
88

99
## Deprecations
1010

11-
XXX https://docs.gitlab.com/update/deprecations/
11+
<i class="fa-duotone fa-solid fa-4x fa-scroll-old"></i> <!-- .element: style="float: right;" -->
1212

13-
XXX https://gitlab-com.gitlab.io/cs-tools/gitlab-cs-tools/what-is-new-since/?tab=deprecations
13+
GitLab documents deprecations thoroughly [](https://docs.gitlab.com/update/deprecations/)
14+
15+
Rolled out in major version updates (release in May)
16+
17+
Web page for more granular search [](https://gitlab-com.gitlab.io/cs-tools/gitlab-cs-tools/what-is-new-since/?tab=deprecations)
18+
19+
Compiled from deprecation files [](https://gitlab.com/gitlab-org/gitlab/-/tree/master/data/deprecations)
1420

1521
### Upcoming features
1622

17-
XXX https://about.gitlab.com/upcoming-releases/
23+
GitLab also documents upcoming features [](https://about.gitlab.com/upcoming-releases/)
1824

19-
XXX https://gitlab-com.gitlab.io/cs-tools/gitlab-cs-tools/what-is-new-since/?tab=features
25+
Web page for more granular search [](https://gitlab-com.gitlab.io/cs-tools/gitlab-cs-tools/what-is-new-since/?tab=features)

160_gitlab_ci/220_services/slides.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
Services [](https://docs.gitlab.com/ee/ci/services/index.html) run side-by-side with CI jobs
1212

13+
Useful for integration tests, e.g. database and other backend services
14+
1315
Services can be declared using the `services` keyword [](https://docs.gitlab.com/ee/ci/yaml/#services)
1416

1517
- For all jobs
@@ -45,6 +47,25 @@ job_name:
4547
script: curl -sv http://nginx
4648
```
4749
50+
---
51+
4852
### Hands-On
4953
5054
See chapter [Services](/hands-on/2025-05-14/220_services/exercise/)
55+
56+
---
57+
58+
## Pro tip: Service logs
59+
60+
Not available in the job log by default
61+
62+
Capture and display them when `CI_DEBUG_TRACE` is set to `true`:
63+
64+
```yaml
65+
job_name:
66+
variables:
67+
CI_DEBUG_TRACE: "true"
68+
services:
69+
- name: nginx:stable
70+
script: curl -sv http://nginx
71+
```

160_gitlab_ci/230_docker/exercise.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For building a container image, you will need to...
2323
1. Use the image `docker:27.3.1` for the job
2424
1. Add a rule to limit execution to pushes to the default branch
2525
1. Add a service to the job using the image `docker:27.3.1-dind`
26-
1. Add a variable `DOCKER_CERT_DIR` to the job and set it to an empty string
26+
1. Add a variable `DOCKER_TLS_CERTDIR` to the job and set it to an empty string
2727
1. Execute the command `docker build --tag hello .`
2828

2929
!!! tip "Heads-Up"
@@ -35,9 +35,10 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe
3535
The service should be set to:
3636

3737
```yaml
38+
variables:
39+
DOCKER_TLS_CERTDIR: ""
3840
services:
3941
- name: docker:27.3.1-dind
40-
command: [ "dockerd", "--host", "tcp://0.0.0.0:2375" ]
4142
```
4243

4344
??? example "Solution (Click if you are stuck)"

0 commit comments

Comments
 (0)