chizkiyahu / delete-untagged-ghcr-action Goto Github PK
View Code? Open in Web Editor NEWAction for delete containers from Github container registry
Home Page: https://github.com/marketplace/actions/delete-untagged-ghcr
License: MIT License
Action for delete containers from Github container registry
Home Page: https://github.com/marketplace/actions/delete-untagged-ghcr
License: MIT License
Provide options to filter images to delete based on tag regex or created or updated date like GitLab.
For example, I would like to cleanup release candidate images (prefixed by candidate/
) after 90 days but always keep release images (prefixed by v
).
docker manifest inspect ghcr.io/plhw/lab-docker/php@sha256:b542bffe4c15244b7e073d711ac91b4cdb71208e2d6bbb8846e1dd576cfa3f51
Traceback (most recent call last):
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 231, in <module>
delete_pkgs(
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 131, in delete_pkgs
deps_pkgs = get_deps_pkgs(owner, tagged_pkgs)
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 95, in get_deps_pkgs
ids.extend(get_image_deps(image))
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 100, in get_image_deps
manifest_txt = get_manifest(image)
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 110, in get_manifest
raise Exception(res.stderr)
Exception: b'no such manifest: ghcr.io/plhw/lab-docker/php@sha256:b542bffe4c15244b7e073d711ac91b4cdb71208e2d6bbb8846e1dd5[76](https://github.com/plhw/lab-docker/actions/runs/4572531190/jobs/8071994976#step:3:76)cfa3f51\n'
Error: Process completed with exit code 1.
and
docker manifest inspect ghcr.io/plhw/lab-docker/php@sha256:b542bffe4c15244b7e073d711ac91b4cdb71208e2d6bbb8846e1dd576cfa3f51
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 231, in <module>
delete_pkgs(
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 131, in delete_pkgs
deps_pkgs = get_deps_pkgs(owner, tagged_pkgs)
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 95, in get_deps_pkgs
ids.extend(get_image_deps(image))
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 100, in get_image_deps
manifest_txt = get_manifest(image)
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 110, in get_manifest
raise Exception(res.stderr)
Exception: b'manifest unknown\n'
- name: "Purge Untagged Packages"
uses: Chizkiyahu/delete-untagged-ghcr-action@v2
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
untagged_only: true
owner_type: org # or user
except_untagged_multiplatform: true
Looking at my packages, which are multiplatform, i did notice packages with an unknown/unknown platform in them, which is weird also...
anyway, mayby there is a simple fix... thx!
Apparently (for whatever reason) some images are generated with no manifest, and this causes the action to fail.
Run Chizkiyahu/delete-untagged-ghcr-action@v2
with:
token: ***
repository_owner: zaphiro-technologies
repository: zaphiro-technologies/data-download-backend
untagged_only: true
owner_type: org
except_untagged_multiplatform: true
Run actions/setup-python@v4
Installed versions
Run pip install -r /home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v[2](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:2)/requirements.txt
Collecting requests (from -r /home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/requirements.txt (line 1))
Downloading requests-2.[3](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:3)1.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 2.1 MB/s eta 0:00:00
Collecting charset-normalizer<[4](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:4),>=2 (from requests->-r /home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/requirements.txt (line 1))
Downloading charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.2/199.2 kB 3.3 MB/s eta 0:00:00
Collecting idna<4,>=2.[5](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:5) (from requests->-r /home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/requirements.txt (line 1))
Downloading idna-3.4-py3-none-any.whl ([6](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:6)1 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 10.1 MB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1 (from requests->-r /home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/requirements.txt (line 1))
Downloading urllib3-2.0.3-py3-none-any.whl (123 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 123.6/123.6 kB 8.[7](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:7) MB/s eta 0:00:00
Collecting certifi>=2017.4.17 (from requests->-r /home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/requirements.txt (line 1))
Downloading certifi-2023.5.7-py3-none-any.whl (156 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 157.0/157.0 kB 10.9 MB/s eta 0:00:00
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2023.5.7 charset-normalizer-3.1.0 idna-3.4 requests-2.31.0 urllib3-2.0.3
Notice: A new release of pip is available: 22.0.4 -> 23.1.2
Notice: To update, run: pip install --upgrade pip
Run args="--token *** "
args: --token *** --repository_owner zaphiro-technologies --repository zaphiro-technologies/data-download-backend --untagged_only true --except_untagged_multiplatform true --owner_type org
docker manifest inspect ghcr.io/zaphiro-technologies/data-download-api@sha256:023a074442207c9901a415ecb927b[8](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:8)c5eca7e74e87bb26b745ff4772b6e3dce7
Traceback (most recent call last):
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 231, in <module>
delete_pkgs(
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 131, in delete_pkgs
deps_pkgs = get_deps_pkgs(owner, tagged_pkgs)
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line [9](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:10)5, in get_deps_pkgs
ids.extend(get_image_deps(image))
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 100, in get_image_deps
manifest_txt = get_manifest(image)
File "/home/runner/work/_actions/Chizkiyahu/delete-untagged-ghcr-action/v2/clean_ghcr.py", line 110, in get_manifest
raise Exception(res.stderr)
Exception: b'no such manifest: ghcr.io/zaphiro-technologies/data-download-api@sha256:023a074442207c9901a[41](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:45)5ecb927b8c5eca7e74e87bb26b7[45](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:49)ff[47](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:51)[72](https://github.com/zaphiro-technologies/data-download-backend/actions/runs/5209690471/jobs/9400797548#step:3:77)b6e3dce7\n'
Error: Process completed with exit code 1.
Would it make sense to simply simply move to the next image and report warning for these cases?
When building multi-platform images there are untagged versions created for the images per platform. These should not be deleted or the tagged version won't work anymore.
Would you consider adding a flag --except-untagged-multiplatform or something along those lines?
I think this should get all tags, read the references in the manifest and filter those from the untagged.
Unfortunately, i don't speak Python so a PR isn't doable on short notice.
Hi there, I'm receiving this warning when running this action.
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/setup-python@v4
.
It seems that the used setup-python action needs to be updated.
A action example: https://github.com/Poeschl/poeschl/actions/runs/8318925402
Edit: That is fixed on the main branch.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.