Closed ipsingh88 closed 2 years ago
Hi @ipsingh88
Looking through the logs:
{
"version": "gcr-cleaner 0.10.0 (103e593b1bf59309841ff4a483cf33f3474acf28, linux/amd64)",
"message": "server is starting"
}
{
"port": "8080",
"message": "server is listening"
}
{
"message": "starting clean request",
"version": "gcr-cleaner 0.10.0 (103e593b1bf59309841ff4a483cf33f3474acf28, linux/amd64)"
}
{
"message": "finding all child repositories",
"roots": [
"us.gcr.io/postgresql-302517/dbt"
]
}
{
"message": "listing child repositories for registry",
"registry": "us.gcr.io"
}
{
"registry": "us.gcr.io",
"message": "found child repositories for registry",
"repos": null
}
{
"message": "recursively listed child repositories",
"in": [
"us.gcr.io/postgresql-302517/dbt"
],
"out": []
}
{
"message": "deleting refs",
"repos": [],
"since": "2022-11-01T14:11:40.721676233Z"
}
{
"refs": {},
"message": "deleted refs"
}
It looks like gcr-cleaner is looking for children of us.gcr.io/postgresql-302517/dbt
.
gcr-cleaner-cli
?The arguments
Hi @ipsingh88
Looking through the logs:
{ "version": "gcr-cleaner 0.10.0 (103e593b1bf59309841ff4a483cf33f3474acf28, linux/amd64)", "message": "server is starting" } { "port": "8080", "message": "server is listening" } { "message": "starting clean request", "version": "gcr-cleaner 0.10.0 (103e593b1bf59309841ff4a483cf33f3474acf28, linux/amd64)" } { "message": "finding all child repositories", "roots": [ "us.gcr.io/postgresql-302517/dbt" ] } { "message": "listing child repositories for registry", "registry": "us.gcr.io" } { "registry": "us.gcr.io", "message": "found child repositories for registry", "repos": null } { "message": "recursively listed child repositories", "in": [ "us.gcr.io/postgresql-302517/dbt" ], "out": [] } { "message": "deleting refs", "repos": [], "since": "2022-11-01T14:11:40.721676233Z" } { "refs": {}, "message": "deleted refs" }
It looks like gcr-cleaner is looking for children of
us.gcr.io/postgresql-302517/dbt
.
- What arguments did you invoke the clean request with?
- Does that repo exist?
- Does it have children?
- Does this reproduce using
gcr-cleaner-cli
?
The arguments I passed are: { "repos": [ "us.gcr.io/postgresql-302517/dbt" ], "recursive": true }
yes the repo exists
3 yes it has children
All the images exists in following paths:
us.gcr.io/postgresql-302517/dbt/master/boosterdbt/
and
us.gcr.io/postgresql-302517/dbt/branch_builds/
Hi @ipsingh88
You can download the gcr-cleaner-cli from the releases page.
You should be able to run something like:
GCRCLEANER_LOG=debug gcr-cleaner-cli -repo us.gcr.io/postgresql-302517/dbt -recursive
Could you also post a screenshot of what you see in the Google Cloud Console for this repository?
Hi @ipsingh88,
not sure it is the same issue as I was having right now, but my problem was that my images were tagged, and gcr-cleaner does not delete those by default. So I had to set the flag -tag-filter-any
like so:
docker run -v "${HOME}/.config/gcloud:/.config/gcloud" -it us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli -grace 720h -repo gcr.io/[MY-PROJECT]/[MY-REPO] -tag-filter-any "^((\d|\w){8})|(\d+\.\d+\.\d+)$"
Running the docker command locally works and deleted all the required images but when scheduled via cloudn Run it is not working
Hi @ipsingh88 - that could be:
Thanks @sethvargo it seems we need Storage Admin role added to service account
TL;DR
The cleaner stopped cleaning any repos
Expected behavior
The cleaner should clean all repos in container registry recursively but doesn't do
Observed behavior
The cleaner is not cleaning any images, the repos url I passed is not being used and seems like it is only looking into us.gcr.io rather than actual repository
Debug log output
Additional information
No response