File tree 10 files changed +139
-32
lines changed
000_rollout/vscode/vscode
10 files changed +139
-32
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ curl -sLf https://github.com/uniget-org/cli/releases/latest/download/uniget_linu
25
25
uniget install \
26
26
gojq \
27
27
go \
28
- glab
28
+ glab \
29
+ gitlabci-local
29
30
EOF
30
31
31
32
COPY --chmod=0755 git.sh /opt/entrypoint.d/
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ See chapter [Job dependencies](/hands-on/2024-11-12/065_job_dependencies/exercis
66
66
67
67
---
68
68
69
- ## Pro tip: XXX
69
+ ## Pro tip: Passing atifacts with ` needs`
70
70
71
- One stage with two jobs and ` needs` -> artifacts work
71
+ If you have one stage with two jobs where one depends on the other using `needs`, artifacts are passed correctly between them.
72
+
73
+ This is important to note because without `needs` jobs in the same stage to not receive artifacts from each other.
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Create a template for compiling a go binary from the job `build` and use it in t
14
14
Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run.
15
15
16
16
??? info "Hint (Click if you are stuck)"
17
- XXX
17
+ ` .gitlab-ci.yml ` :
18
18
19
19
```yaml
20
20
.build-go:
Original file line number Diff line number Diff line change @@ -109,12 +109,11 @@ Template to disable job:
109
109
110
110
## Pro tip: Fields for rules
111
111
112
- XXX variables [](https://docs.gitlab.com/ee/ci/yaml/#rulesvariables)
112
+ Rules not only control execution of jobs but can also configure jobs through the use of the following fields:
113
113
114
- XXX variable precedence
114
+ - Add additional ` variables` [](https://docs.gitlab.com/ee/ci/yaml/#rulesvariables) to customize the behaviour of the job
115
+ - Limit a rule to changes `changes` [](https://docs.gitlab.com/ee/ci/yaml/#ruleschanges) on specific files
116
+ - Execute a job only if a specific file `exists` [](https://docs.gitlab.com/ee/ci/yaml/#rulesexists)
117
+ - Make a job dependent on other jobs using `needs` [](https://docs.gitlab.com/ee/ci/yaml/#rulesneeds)
115
118
116
- XXX changes [](https://docs.gitlab.com/ee/ci/yaml/#ruleschanges)
117
-
118
- XXX exists [](https://docs.gitlab.com/ee/ci/yaml/#rulesexists)
119
-
120
- XXX needs [](https://docs.gitlab.com/ee/ci/yaml/#rulesneeds)
119
+ Rules become especially powerful when combining the fields supported by rules - including `if`
Original file line number Diff line number Diff line change 1
1
# Troubleshooting
2
2
3
3
!!! tip "Goal"
4
- Learn how to...
5
-
6
- - XXX
4
+ Learn how to run a pipeline locally
7
5
8
6
## Preparation
9
7
10
- XXX
8
+ Open a terminal and make sure the working directory is your repository.
9
+
10
+ ## Task 1: Run a single job
11
11
12
- ## Task: Use gcil
12
+ Select a single job to run:
13
13
14
14
``` shell
15
15
gcil
16
- gcil -p
17
- gcil -l
18
16
```
17
+
18
+ ## Task 2: Run the whole pipeline
19
+
20
+ Run the whole pipeline:
21
+
22
+ ``` shell
23
+ gcil --pipeline
24
+ ```
25
+
26
+ ## Task 3: Explore pre-defined variables
27
+
28
+ Add a job to print all environment variables.
29
+
30
+ ??? info "Hint (Click if you are stuck)"
31
+ Use the following command to show all environment variables: ` printenv | sort `
32
+
33
+ ??? example "Solution (Click if you are stuck)"
34
+
35
+ ```yaml
36
+ #...
37
+ new_job:
38
+ stage: check
39
+ script: |
40
+ printenv | sort
41
+ #...
42
+ ```
43
+
44
+ ## Task 4: Pass variables to the pipeline
45
+
46
+ Check the help how to pass a variable called ` AUTHOR ` with a value of your choice.
47
+
48
+ ??? info "Hint (Click if you are stuck)"
49
+ The parameter ` -e ` is used to pass variables to the pipeline.
50
+
51
+ ??? example "Solution (Click if you are stuck)"
52
+
53
+ ```shell
54
+ gcil --pipeline --pipeline -e FOO=bar
55
+ ```
Original file line number Diff line number Diff line change @@ -30,9 +30,17 @@ Use `command || true` is dangerous because it hides errors
30
30
31
31
# # Shotgun debugging
32
32
33
- XXX many echos
33
+ Adding many `echo` stagements is the most prominent (and hated) approach
34
34
35
- XXX if then else
35
+ Better add regular output to the script blocks...
36
+
37
+ ...especially when using multi-line commands
38
+
39
+ Add output to both branches of `if-then-else` statements
40
+
41
+ Consider moving commands to a script file...
42
+
43
+ ...this can enable local debugging
36
44
37
45
---
38
46
@@ -44,7 +52,7 @@ Run whole pipelines locally using `gcil` (formerly `gitlabci-local`) [](https://
44
52
45
53
Supports shell and Docker executor
46
54
47
- XXX
55
+ Runs one or more jobs or even the whole pipeline
48
56
49
57
# ## ~~gitlab-runner~~
50
58
Original file line number Diff line number Diff line change @@ -93,7 +93,15 @@ All features work across different runners
93
93
94
94
## Pro tip: Finding existing runners
95
95
96
- XXX
96
+ No single place to discover runners
97
+
98
+ See the CI/CD settings in the runner section
99
+
100
+ Applies to groups and projects
101
+
102
+ The list shows runners available
103
+
104
+ Offers the option to disable instance runners
97
105
98
106
---
99
107
Original file line number Diff line number Diff line change @@ -34,14 +34,18 @@ See chapter [caches](/hands-on/2024-11-12/265_caches/exercise/)
34
34
35
35
## Pro tip: Clear the cache
36
36
37
- XXX [ ] ( https://docs.gitlab.com/ee/ci/caching/#clearing-the-cache )
37
+ Clear the cache [ ] ( https://docs.gitlab.com/ee/ci/caching/#clearing-the-cache ) in two ways:
38
+
39
+ 1 . Change the cache key in your pipeline
40
+ 1 . On the pipeline page, click ` Clear runner caches ` in the upper right corner
38
41
39
42
---
40
43
41
44
## Pro tip 2: Runner local cache
42
45
43
- XXX [ ] ( https://docs.gitlab.com/ee/ci/caching/#where-the-caches-are-stored )
46
+ For some executors, the runner stores the cache locally [ ] ( https://docs.gitlab.com/ee/ci/caching/#where-the-caches-are-stored ) when not configured otherwise
44
47
45
- Shell: /home/gitlab-runner/ cache/< user >/< project >/< cache-key >/cache.zip
48
+ The local cache is located in the following directories:
46
49
47
- Docker: /var/lib/docker/volumes/<volume-id >/_ data/<user >/<project >/<cache-key >/cache.zip
50
+ - Shell: ` /home/gitlab-runner/cache/<user>/<project>/<cache-key>/cache.zip `
51
+ - Docker: ` /var/lib/docker/volumes/<volume-id>/_data/<user>/<project>/<cache-key>/cache.zip `
Original file line number Diff line number Diff line change 3
3
!!! tip "Goal"
4
4
Learn how to...
5
5
6
- - XXX
6
+ - Upload secure files
7
+ - Use secure files in a job
7
8
8
9
!!! tip "Hints"
9
10
[ Official documentation] ( https://docs.gitlab.com/ee/ci/secure_files/ ) for Secure Files
10
11
11
- ## Task: XXX
12
+ ## Task 1: Upload a secure file
13
+
14
+ XXX
15
+
16
+ ## Task 2: Use the secure file
12
17
13
18
XXX
Original file line number Diff line number Diff line change 2
2
3
3
<i class =" fa-duotone fa-box-open-full fa-8x fa-duotone-colors " style =" float : right ; color : grey ;" ></i >
4
4
5
- ## Secure Files
5
+ ## Secure Files (experimental)
6
6
7
7
---
8
8
9
- ## Secure Files
9
+ ## Secure Files (experimental)
10
10
11
11
<i class =" fa-duotone fa-solid fa-4x fa-sparkles " ></i > <!-- .element: style="float: right;" -->
12
12
13
- XXX [ ] ( https://docs.gitlab.com/ee/ci/secure_files/ )
13
+ Secure files [ ] ( https://docs.gitlab.com/ee/ci/secure_files/ ) are encrypted at rest
14
14
15
- XXX [ ] ( https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files )
15
+ Each secure file is encrypted with a unique key...
16
+
17
+ ...and a SHA256 hash is stored in the database
18
+
19
+ Up to 100 files and up to 5MB per file
20
+
21
+ Binary files are supported
22
+
23
+ Stored outside the repository and are not version controlled
24
+
25
+ ### Upload
26
+
27
+ Either through the UI [ ] ( https://docs.gitlab.com/ee/ci/secure_files/#add-a-secure-file-to-a-project )
28
+
29
+ Or through the API [ ] ( https://docs.gitlab.com/ee/api/secure_files.html )
30
+
31
+ The Developer role is required to access secure files
32
+
33
+ ---
34
+
35
+ ## Secure Files (experimental)
36
+
37
+ ### Use secure files
38
+
39
+ Downloading secure files in a pipeline requires a binary [ ] ( https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files )
40
+
41
+ Environment variable ` SECURE_FILES_DOWNLOAD_PATH ` defines where files should be downloaded to
42
+
43
+ ``` yaml
44
+ test :
45
+ variables :
46
+ SECURE_FILES_DOWNLOAD_PATH : ' ./where/files/should/go/'
47
+ script : |
48
+ curl \
49
+ --silent \
50
+ --url "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" \
51
+ | bash
52
+ ` ` `
53
+
54
+ ---
55
+
56
+ ## Hands-On
57
+
58
+ See chapter [Secure Files](/hands-on/2024-11-12/320_secure_files/exercise/)
You can’t perform that action at this time.
0 commit comments