Unify the Docker Image build CI template (default branch)
What does this MR do?
We are using main
as new default branch instead of master
in our Developer Evangelism projects. In community workshops, we often show how to build a Docker image: Navigate into the editor, select Docker
and that's it, let it build.
The current CI template has master
hardcoded in both the job name and the only/except rule and requires manual changes (job name and 2x rules edit).
This MR provides a generic single job with conditional handling for the branches, suggested in !51931 (comment 529010707) It also adds more logging to immediately see what's going on in the CI/CD job logs.
This replaces the old suggestion with 2 jobs and renamed job names.
The documentation in doc/user/packages/container_registry/index.md
may need an update, although there are more locations with only/except master examples (grep -r -- '- master' doc/
).
This MR is the first iteration of updating the CI templates to help move https://gitlab.com/groups/gitlab-org/-/epics/3600 forward.
cc @dhershkovitch @nadia_sotnikova @danielgruesso
Screenshots (strongly suggested)
Default branch (in this case, 'main') in https://gitlab.com/dnsmichi/ci-cd-playground/-/jobs/1102222235
Any branch other than the default branch in https://gitlab.com/dnsmichi/ci-cd-playground/-/jobs/1101989114
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team