Can't use GitLab Registry for builder images
It's currently impossible to use a builder image stored in GitLab Registry while using gitlab-ci-token
for registry authentication.
We are building a builder image in prepare stage which we would like to use in a later stage. However, before_script
is called after the image gets pulled, which means that it's not possible to login to GitLab registry and thus this only incidentally works if build stage is running on the same runner as the prepare stage, which is obviously not guaranteed.
before_script:
- docker login -u gitlab-ci-token -e gitlab@example.com -p $CI_BUILD_TOKEN $GITLAB_REPO
build_builder:
stage: prepare
script:
- docker build --pull -t $BUILDER_IMAGE_NAME builder
- docker push $BUILDER_IMAGE_NAME
build:
image: $BUILDER_IMAGE_NAME
...