Docker Builds Fail for Non Protected Branches
GitLab Issues
GitLab will only inject Protected
variables into Protected
Branches and Tags. This does not include Merge Requests (MRs) even when both the source and target are Protected
. The result is that pipelines using these protected variables will work only on protected branches/tags without an MR.
Feature Request
The docker builds for non protected branches do not have credentials injected from Protected Variables.
This branch test-docker-image-build so the variables needed will not get injected to the pipeline as they are Protected
.
This particular pipeline is failing due to the HARBOR_BB_STAGING_WRITE_*
variables are not available.
Why
This could be easily resolved for GitLab Maintainers to make their development/feature branch protected
, but not everyone is a maintainer in their projects. Currently, to test a change to a docker build, we would a maintainer to make the development/feature branch protected.
Proposed Solution
Option 1. A possible solution would be to unprotect the variables.
Option 2. Create "protected branch rule" using Wildcards such as -docker or docker/. Developers would have to create branches following this pattern.