GitLab Predefined CI/CD variable CI_REGISTRY_IMAGE empty
Asked Answered
S

1

5

I'm trying to use Kaniko to build/push my docker images to GitLab Container Registry (GitLab self-managed 15.3.0, with docker runner): https://docs.gitlab.com/ee/ci/docker/using_kaniko.html#building-a-docker-image-with-kaniko

Command being executed is

$ /kaniko/executor --context "${CI_PROJECT_DIR}/DSPWeb" --dockerfile "${CI_PROJECT_DIR}/DSPWeb/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}"

but it results in this error:

error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: getting tag for destination: a repository name must be specified

It seems that the issue is that the predefined CI/CD GitLab build-in variable is empty/not resolving. Echo'ing the vars results in:

$ echo $CI_PROJECT_DIR
/builds/xxx/datashieldingplatform
$ echo $CI_REGISTRY_IMAGE
$ echo $CI_REGISTRY
$ echo $CI_COMMIT_SHA
67de133f333b57f8effed69a497adf256945eb15

CI_PROJECT_DIR & CI_COMMIT_SHA are resolving just fine.

So, might this be a permission issue?

Thank you

Sharkey answered 29/9, 2022 at 17:50 Comment(1)
I found the issue, the actual GitLab Container Registry was never enabled on the gitlab host. docs.gitlab.com/ee/administration/packages/…Sharkey
T
7

An empty $CI_REGISTRY_IMAGE probably means "container registry" is not enabled either for this project or globally.

If you cannot see "Container registries" under "Packages and Registries" on your repository page's left pane, go to "Settings > General", expand "Visibility, project features, permissions", scroll down to "Container registry" and set up to your needs.

Check if container registry is enabled on the host (in most cases, it is by default).

Trichomonad answered 19/10, 2022 at 6:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.