@@ -47,9 +47,8 @@ Example:
47
47
48
48
References:
49
49
50
- https://docs.gitlab.com/runner/install/linux-repository.html
51
-
52
- https://docs.gitlab.com/runner/register/index.html
50
+ * https://docs.gitlab.com/runner/install/linux-repository.html
51
+ * https://docs.gitlab.com/runner/register/index.html
53
52
54
53
~~~ENDSECTION~~~
55
54
@@ -92,11 +91,9 @@ Hint: GitLab offers an integrated Container Registry to store container images f
92
91
93
92
References:
94
93
95
- https://docs.docker.com
96
-
97
- https://podman.io/
98
-
99
- https://docs.gitlab.com/runner/install/docker.html
94
+ * https://docs.docker.com
95
+ * https://podman.io/
96
+ * https://docs.gitlab.com/runner/install/docker.html
100
97
101
98
~~~ENDSECTION~~~
102
99
@@ -116,7 +113,7 @@ https://docs.gitlab.com/runner/install/docker.html
116
113
117
114
Reference:
118
115
119
- https://docs.gitlab.com/runner/install/
116
+ * https://docs.gitlab.com/runner/install/
120
117
121
118
~~~ENDSECTION~~~
122
119
@@ -154,6 +151,7 @@ Note: Runners can be defined per Instance, Group or Project.
154
151
155
152
You can install your own runner:
156
153
154
+ @@@Sh
157
155
sudo yum install -y yum-utils
158
156
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
159
157
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
@@ -176,6 +174,7 @@ In the .gitlab-ci.yml file, you can define:
176
174
177
175
Example:
178
176
177
+ @@@Yaml
179
178
image: docker.io/alpine:latest
180
179
181
180
name_of_my_job:
@@ -203,9 +202,10 @@ https://docs.gitlab.com/ee/ci/yaml/gitlab_ci_yaml.html
203
202
204
203
Example:
205
204
205
+ @@@Yaml
206
206
image: docker.io/alpine:latest
207
207
208
- my_tests :
208
+ my_job :
209
209
script:
210
210
- exit 1
211
211
@@ -224,9 +224,12 @@ Example:
224
224
225
225
Example:
226
226
227
+ <!-- -->
228
+
229
+ @@@Yaml
227
230
image: docker.io/alpine:latest
228
231
229
- my_tests :
232
+ my_job :
230
233
script:
231
234
- exit 1
232
235
@@ -243,10 +246,12 @@ Example:
243
246
* Navigate your GitLab Web interface and click the button 'Web IDE'
244
247
* Click 'Add file' and create the `.gitlab-ci.yml` file from the suggestions
245
248
246
- @@@ Sh
249
+ <!-- -->
247
250
251
+ @@@Yaml
248
252
image: docker.io/alpine:latest
249
- my_tests:
253
+
254
+ my_job:
250
255
script:
251
256
- exit 1
252
257
@@ -291,11 +296,10 @@ Future examples and tests work the same way.
291
296
292
297
### Modify exit code
293
298
294
- @@@ Sh
295
-
299
+ @@@Yaml
296
300
image: docker.io/alpine:latest
297
301
298
- all_tests :
302
+ my_job :
299
303
script:
300
304
- exit 0
301
305
@@ -355,6 +359,7 @@ Reference: https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management
355
359
356
360
Example:
357
361
362
+ @@@Yaml
358
363
before_script:
359
364
- apk update && apk add python3 py-pip
360
365
- pip install --break-system-packages markdown Pygments pymarkdownlnt
@@ -369,15 +374,15 @@ Example:
369
374
370
375
### Edit .gitlab-ci.yml and add before_script
371
376
372
- @@@ Sh
377
+ @@@Yaml
373
378
374
379
image: docker.io/alpine:latest
375
380
376
381
before_script:
377
382
378
383
### Update apk and install Python/pip
379
384
380
- @@@ Sh
385
+ @@@Yaml
381
386
382
387
image: docker.io/alpine:latest
383
388
@@ -386,7 +391,7 @@ Example:
386
391
387
392
### Install Markdown Python libraries
388
393
389
- @@@ Sh
394
+ @@@Yaml
390
395
391
396
image: docker.io/alpine:latest
392
397
@@ -396,15 +401,15 @@ Example:
396
401
397
402
### Verify the content
398
403
399
- @@@ Sh
404
+ @@@Yaml
400
405
401
406
image: docker.io/alpine:latest
402
407
403
408
before_script:
404
409
- apk update && apk add python3 py-pip
405
410
- pip install --break-system-packages markdown Pygments pymarkdownlnt
406
411
407
- all_tests :
412
+ my_job :
408
413
script:
409
414
- exit 0
410
415
@@ -428,7 +433,8 @@ This is an example of how to do it from a CLI, the Gitlab WebIDE is an obvious a
428
433
429
434
Example:
430
435
431
- my_tests:
436
+ @@@Yaml
437
+ lint_markdown:
432
438
script:
433
439
- pymarkdown scan README.md
434
440
allow_failure: true
@@ -449,7 +455,8 @@ Example:
449
455
450
456
Example:
451
457
452
- my_tests:
458
+ @@@Yaml
459
+ lint_markdown:
453
460
script:
454
461
- pymarkdown scan README.md
455
462
allow_failure: true
@@ -464,9 +471,8 @@ Example:
464
471
465
472
### Edit .gitlab-ci.yml and modify the job
466
473
467
- @@@ Sh
468
-
469
- my_tests:
474
+ @@@Yaml
475
+ lint_markdown:
470
476
script:
471
477
- pymarkdown scan README.md
472
478
allow_failure: true
@@ -483,7 +489,8 @@ Example:
483
489
484
490
Example:
485
491
486
- markdown:
492
+ @@@Yaml
493
+ convert_markdown:
487
494
script:
488
495
- python3 -m markdown README.md > README.html
489
496
artifacts:
@@ -517,23 +524,23 @@ Example:
517
524
518
525
### Edit .gitlab-ci.yml and add markdown section
519
526
520
- @@@ Sh
527
+ @@@Yaml
521
528
522
529
...
523
530
524
- all_tests :
531
+ my_job :
525
532
script:
526
533
- exit 0
527
534
528
- markdown :
535
+ convert_markdown :
529
536
530
537
### Add script to convert Markdown into HTML
531
538
532
- @@@ Sh
539
+ @@@Yaml
533
540
534
541
...
535
542
536
- markdown :
543
+ convert_markdown :
537
544
script:
538
545
- python3 -m markdown README.md > README.html
539
546
@@ -542,11 +549,11 @@ Example:
542
549
Add `paths` section which includes `README.html` as entry.
543
550
Tell GitLab to expire this artifact in `1 week`.
544
551
545
- @@@ Sh
552
+ @@@Yaml
546
553
547
554
...
548
555
549
- markdown :
556
+ convert_markdown :
550
557
script:
551
558
- python3 -m markdown README.md > README.html
552
559
artifacts:
@@ -556,19 +563,19 @@ Tell GitLab to expire this artifact in `1 week`.
556
563
557
564
### Verify the content
558
565
559
- @@@ Sh
566
+ @@@Yaml
560
567
561
568
image: docker.io/alpine:latest
562
569
563
570
before_script:
564
571
- apk update && apk add python3 py-pip
565
572
- pip install --break-system-packages markdown Pygments pymarkdownlnt
566
573
567
- all_tests :
574
+ my_job :
568
575
script:
569
576
- exit 0
570
577
571
- markdown :
578
+ convert_markdown :
572
579
- python3 -m markdown README.md > README.html
573
580
artifacts:
574
581
paths:
@@ -673,6 +680,7 @@ CI Variables are environment variables that are accessible in the job.
673
680
674
681
Example:
675
682
683
+ @@@Yaml
676
684
job1:
677
685
script:
678
686
- echo "Job for the Commit: '$CI_COMMIT_SHA'"
@@ -691,12 +699,13 @@ Usecases: Credentials (`AWS_ACCESS_KEY`) or controlling builds (`CMAKE_C_FLAGS`)
691
699
692
700
Example:
693
701
702
+ @@@Yaml
694
703
job_name
695
704
script:
696
- - echo $MYVAR
705
+ - echo $PLATFORM
697
706
parallel:
698
707
matrix:
699
- - MYVAR : [hello, hallo ]
708
+ - PLATFORM : [Linux, Windows, macOS ]
700
709
701
710
!SLIDE supplemental exercises
702
711
# Lab ~~~SECTION:MAJOR~~~.~~~SECTION:MINOR~~~: Add jobs using variables
@@ -722,6 +731,7 @@ Example:
722
731
723
732
Example:
724
733
734
+ @@@Yaml
725
735
my_parallel_job:
726
736
before_script:
727
737
- env
0 commit comments