Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reg rm irritatingly states "docker.io" for image deleted from GitLab registry #225

Open
bittner opened this issue May 20, 2023 · 1 comment

Comments

@bittner
Copy link

bittner commented May 20, 2023

GitLab doesn't have its own way to delete container images from their registry. Their documentation suggests to use reg rm to tackle the problem.

When I run the suggested setup the output states "Deleted docker.io/...", which is a bit irritating.

...
$ ./reg rm -d --auth-url ${CI_REGISTRY} -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${IMAGE}:${TAG}
time="2023-05-20T14:57:58Z" level=info msg="domain: docker.io"
time="2023-05-20T14:57:58Z" level=info msg="server address: registry.gitlab.com"
2023/05/20 14:57:58 registry.ping url=https://registry.gitlab.com/v2/
2023/05/20 14:57:58 registry.manifests.get url=https://registry.gitlab.com/v2/foo/bar/baz-container/manifests/mr1 repository=foo/bar/baz-container ref=mr1
2023/05/20 14:57:58 registry.manifests.delete url=https://registry.gitlab.com/v2/foo/bar/baz-container/manifests/sha256:2dabbf05c801a3e63d598714396d4ddbae63d0c993a6386d26683b4d74e54833 repository=foo/bar/baz-container digest=sha256:2dabbf05c801a3e63d598714396d4ddbae63d0c993a6386d26683b4d74e54833
Deleted docker.io/foo/bar/baz-container:mr1@sha256:2dabbf05c801a3e63d598714396d4ddbae63d0c993a6386d26683b4d74e54833

I understand that the output states "server address: registry.gitlab.com" in line two. But this is easily overlooked.

Shouldn't the last line of the output use the actual registry server address?

@aarongoldenthal
Copy link

This will happen if you're using the GitLab documentation as written, with IMAGE: $CI_PROJECT_PATH (which is <namespace>/<project>, and not actually correct). Reg resolves this properly, but it should be IMAGE: $CI_REGISTRY_IMAGE (or whatever the image name is, including the $CI_REGISTRY domain), which is the complete name of the repository.

With that, the reg output is as expected:

$ reg rm -d --auth-url "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY_IMAGE/tmp:$CI_PIPELINE_ID"
time="2023-12-26T18:19:36Z" level=info msg="domain: registry.gitlab.com"
time="2023-12-26T18:19:36Z" level=info msg="server address: registry.gitlab.com"
2023/12/26 18:19:36 registry.ping url=https://registry.gitlab.com/v2/
2023/12/26 18:19:36 registry.manifests.get url=https://registry.gitlab.com/v2/gitlab-ci-utils/curl-jq/tmp/manifests/1119548976 repository=gitlab-ci-utils/curl-jq/tmp ref=1119548976
2023/12/26 18:19:37 registry.manifests.delete url=https://registry.gitlab.com/v2/gitlab-ci-utils/curl-jq/tmp/manifests/sha256:559385d098c393708b4417c58e7905fd91bbb6bc69437ce2d7905d46a55d6578 repository=gitlab-ci-utils/curl-jq/tmp digest=sha256:559385d098c393708b4417c58e7905fd91bbb6bc69437ce2d7905d46a55d6578
Deleted registry.gitlab.com/gitlab-ci-utils/curl-jq/tmp:1119548976@sha256:559385d098c393708b4417c58e7905fd91bbb6bc69437ce2d7905d46a55d6578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants