registry-garbage-collect --delete-manifests unlinks untagged manifests that are still referenced by a manifest_list
Summary
gitlab-ctl registry-garbage-collect --delete-manifests
deletes all manifests, even if they are tagged
Steps to reproduce
assumed existing:
- private gitlab instance with registry setup and enabled
- project available at
my-gitlab-instance.com/containers/external
- working docker client with experimental mode enabled (add entry
"experimental": "enabled"
to your~/.docker/config.json
file)
export CI_REGISTRY=registry.gitlab.com
export REGISTRY_PROJECT=${CI_REGISTRY}/neroburner/registry-cleanup-issue-project
echo "=== run docker version to see if docker is working"
docker version
echo "=== download various images from dockerhub ==="
docker pull prom/prometheus:latest
docker tag prom/prometheus:latest ${REGISTRY_PROJECT}/amd64/prom-prometheus:latest
docker push ${REGISTRY_PROJECT}/amd64/prom-prometheus:latest
docker pull prom/prometheus-linux-armv7:latest
docker tag prom/prometheus-linux-armv7:latest ${REGISTRY_PROJECT}/arm32v7/prom-prometheus:latest
docker push ${REGISTRY_PROJECT}/arm32v7/prom-prometheus:latest
docker pull prom/prometheus-linux-arm64:latest
docker tag prom/prometheus-linux-arm64:latest ${REGISTRY_PROJECT}/arm64v8/prom-prometheus:latest
docker push ${REGISTRY_PROJECT}/arm64v8/prom-prometheus:latest
echo "=== create manifest for convenience ==="
docker manifest create ${REGISTRY_PROJECT}/prom-prometheus:latest ${REGISTRY_PROJECT}/amd64/prom-prometheus:latest ${REGISTRY_PROJECT}/arm32v7/prom-prometheus:latest ${REGISTRY_PROJECT}/arm64v8/prom-prometheus:latest
docker manifest push --purge ${REGISTRY_PROJECT}/prom-prometheus:latest
check registry for existing manifest
on the gitlab-instance run the cleanup
sudo gitlab-ctl registry-garbage-collect --delete-manifests
see, that the manifest entry is invalid
Example Project
https://gitlab.com/NeroBurner/registry-cleanup-issue-project/container_registry
What is the current bug behavior?
the manifest entry gets invalided by the cleanup
What is the expected correct behavior?
tagged manifest should still be there
Relevant logs and/or screenshots
screenshots posted above
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 18.04 Current User: git Using RVM: no Ruby Version: 2.6.3p62 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.22.0 Sidekiq Version:5.2.7 Go Version: unknown
GitLab information Version: 12.3.2 Revision: d3cda7c1f96 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.9 URL: https://my-gitlab-instance.com HTTP Clone URL: https://my-gitlab-instance.com/some-group/some-project.git SSH Clone URL: git@my-gitlab-instance.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 10.0.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 10.0.0 ? ... OK (10.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 1/2 ... yes 5/4 ... yes 4/5 ... yes 6/6 ... yes 5/7 ... yes 5/8 ... yes 6/9 ... yes 5/10 ... yes 7/11 ... yes 7/12 ... yes 9/13 ... yes 5/14 ... yes 5/16 ... yes 11/17 ... yes 5/18 ... yes 5/19 ... yes 13/20 ... yes 13/21 ... yes 13/23 ... yes 8/24 ... yes 7/25 ... yes 15/26 ... yes 7/27 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.3) Git version >= 2.22.0 ? ... yes (2.22.0) Git user has default SSH configuration? ... yes Active users: ... 7 Is authorized keys file accessible? ... yes
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
fix tagged manifest detection with registry-garbage-collect --delete-manifests