diff --git a/160_gitlab_ci/110_triggers/slides.md b/160_gitlab_ci/110_triggers/slides.md index 740e6450..c6cb580b 100644 --- a/160_gitlab_ci/110_triggers/slides.md +++ b/160_gitlab_ci/110_triggers/slides.md @@ -236,7 +236,18 @@ trigger-job: --- -## Pro tip 4: Permissions for include +## Pro tip 4: Types of variables to forward + +Use `trigger:forward` [](https://docs.gitlab.com/ee/ci/yaml/#triggerforward) to define which types of variables to forward to downstream pipelines + +- `yaml_variables` - variables defined in the trigger job +- `pipeline_variables` - variables passed to this pipeline [](https://docs.gitlab.com/ee/ci/variables/index.html#cicd-variable-precedence) + +This only works for the direct downstream pipeline + +--- + +## Pro tip 5: Permissions for include When including a file from another project... @@ -253,7 +264,7 @@ job_name: --- -## Pro tip 5: Dynamic includes +## Pro tip 6: Dynamic includes Included file can also be generated before job start [](https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html#dynamic-child-pipelines) diff --git a/160_gitlab_ci/120_templates/exercise.md b/160_gitlab_ci/120_templates/exercise.md index fc66d655..028a8979 100644 --- a/160_gitlab_ci/120_templates/exercise.md +++ b/160_gitlab_ci/120_templates/exercise.md @@ -117,17 +117,7 @@ Move the template into a separate file `go.yaml` and use the [`include`](https:/ Afterwards check the pipeline in the GitLab UI. You should see a successful pipeline run. ??? info "Hint (Click if you are stuck)" - `go.yaml`: - - ```yaml - .build-go: - script: - - | - go build \ - -ldflags "-X main.Version=${CI_COMMIT_REF_NAME} -X 'main.Author=${AUTHOR}'" \ - -o hello \ - . - ``` + Create the file `go.yaml` and move the template there. Use the `include` keyword to import the template. ??? example "Solution (Click if you are stuck)" `go.yaml`: diff --git a/160_gitlab_ci/130_rules/slides.md b/160_gitlab_ci/130_rules/slides.md index bffd481a..958d124a 100644 --- a/160_gitlab_ci/130_rules/slides.md +++ b/160_gitlab_ci/130_rules/slides.md @@ -79,6 +79,9 @@ Adjust order from most specific... Use GitLab Pages to create a download page [](https://docs.gitlab.com/ee/user/project/pages/) +- The job must be called `pages` [](https://docs.gitlab.com/ee/ci/yaml/#pages) +- The must create an artifact from the directory called `public` + See chapter [Rules](/hands-on/2024-11-21/130_rules/exercise/) --- @@ -157,7 +160,17 @@ job_name: --- -# Pro tip 5: GitLab Pages access control +# Pro tip 5: Tweaking GitLab Pages + +The content directory can be configured using `pages:publish` [](https://docs.gitlab.com/ee/ci/yaml/#pagespublish) + +Premium/Ultimate: Deploy to a sub-directory `pages:pages.path_prefix` [](https://docs.gitlab.com/ee/ci/yaml/#pagespagespath_prefix) + +Premium/Ultimate: Expire a pages deployment `pages:pages.expire_in` [](https://docs.gitlab.com/ee/ci/yaml/#pagespagesexpire_in) + +--- + +# Pro tip 6: GitLab Pages access control GitLab Pages are public by default diff --git a/160_gitlab_ci/140_merge_requests/exercise.md b/160_gitlab_ci/140_merge_requests/exercise.md index edf51661..b160e832 100644 --- a/160_gitlab_ci/140_merge_requests/exercise.md +++ b/160_gitlab_ci/140_merge_requests/exercise.md @@ -33,7 +33,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never @@ -182,7 +181,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/150_matrix_jobs/exercise.md b/160_gitlab_ci/150_matrix_jobs/exercise.md index 972576de..16851c02 100644 --- a/160_gitlab_ci/150_matrix_jobs/exercise.md +++ b/160_gitlab_ci/150_matrix_jobs/exercise.md @@ -58,7 +58,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never @@ -237,7 +236,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/220_services/exercise.md b/160_gitlab_ci/220_services/exercise.md index 48a2c2d0..61a15dbe 100644 --- a/160_gitlab_ci/220_services/exercise.md +++ b/160_gitlab_ci/220_services/exercise.md @@ -38,7 +38,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never @@ -174,7 +173,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/230_docker/exercise.md b/160_gitlab_ci/230_docker/exercise.md index 84c934e0..c39e0108 100644 --- a/160_gitlab_ci/230_docker/exercise.md +++ b/160_gitlab_ci/230_docker/exercise.md @@ -51,7 +51,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never @@ -175,7 +174,8 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe ## Bonus task: Create a template for building container images -Similar to the template for building and testing Go, create a template for building container images including logging in to and out of a container registry. +Similar to the template for building and testing Go, create a template for building container images including logging in and out of a container registry. + diff --git a/160_gitlab_ci/240_registries/exercise.md b/160_gitlab_ci/240_registries/exercise.md index b38ab5b6..0cb6361a 100644 --- a/160_gitlab_ci/240_registries/exercise.md +++ b/160_gitlab_ci/240_registries/exercise.md @@ -38,7 +38,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/250_releases/exercise.md b/160_gitlab_ci/250_releases/exercise.md index b6a3f9e7..d0c5236f 100644 --- a/160_gitlab_ci/250_releases/exercise.md +++ b/160_gitlab_ci/250_releases/exercise.md @@ -46,7 +46,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/270_renovate/exercise.md b/160_gitlab_ci/270_renovate/exercise.md index 820b6409..d0f01560 100644 --- a/160_gitlab_ci/270_renovate/exercise.md +++ b/160_gitlab_ci/270_renovate/exercise.md @@ -40,7 +40,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/280_security/exercise.md b/160_gitlab_ci/280_security/exercise.md index 522b5931..6a4d8f98 100644 --- a/160_gitlab_ci/280_security/exercise.md +++ b/160_gitlab_ci/280_security/exercise.md @@ -34,7 +34,6 @@ Afterwards check the pipeline in the GitLab UI. You should see a successful pipe - if: $CI_PIPELINE_SOURCE == 'push' - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'pipeline' - if: $CI_PIPELINE_SOURCE == 'api' when: never diff --git a/160_gitlab_ci/agenda.md b/160_gitlab_ci/agenda.md index d1ea934a..305e34e1 100644 --- a/160_gitlab_ci/agenda.md +++ b/160_gitlab_ci/agenda.md @@ -1,3 +1,13 @@ +## Questions + +### Do you have any experience with CI/CD? + +### Are you using GitLab? + +### Are you using GitLab CI? + +--- + ## Agenda | From | To | What | diff --git a/2024-11-21_heise-GitLab-CI.html b/2024-11-21_heise-GitLab-CI.html index 3d93e1be..2a37f515 100644 --- a/2024-11-21_heise-GitLab-CI.html +++ b/2024-11-21_heise-GitLab-CI.html @@ -74,12 +74,14 @@