delete-package-versions
delete-package-versions copied to clipboard
ignore-versions doesn't seem to work with container packages (ghcr)
Trying to use ignore-versions
with the new support for ghcr container package types, but it doesn't seem to work. I am trying to delete beta packages when pushing into the develop branch, and non beta packages when pushing into main. But ATM it just deletes the packages regardless of the name.
My full example config is here:
name: CI
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: npm install
run: npm install
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
run: node ./node_modules/gulp/bin/gulp.js ci-docker-build
env:
DEBUG: true
- name: Docker publish
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
run: node ./node_modules/gulp/bin/gulp.js ci-docker-publish
env:
DEBUG: true
- name: Docker cleanup develop images
if: github.ref == 'refs/heads/develop'
uses: actions/delete-package-versions@v4
with:
package-name: 'dave-test'
package-type: 'container'
min-versions-to-keep: 2
ignore-versions: '^((?!beta).)*$'
- name: Docker cleanup production images
if: github.ref == 'refs/heads/main'
uses: actions/delete-package-versions@v4
with:
package-name: 'dave-test'
package-type: 'container'
min-versions-to-keep: 3
ignore-versions: 'beta'
Hello @DaveFPM
The ignore-versions
input param filters out all versions whose names match the regex supplied.
As checked from the DB, none of the version names for package name dave-test
match the regex beta
& hence all the versions are getting deleted as expected.
Also pls note that this action currently doesn't support filtering based on container tags & I suppose you might be looking out for something like that?
May I suggest you please go through our marketplace documentation on how this input param works?
Also pls note that this action currently doesn't support filtering based on container tags & I suppose you might be looking out for something like that?
Yes, maybe thats my confusion. I would have thought it would have worked to filter "Tagged image versions".
I guess this is not the case, so more of a feature request then?
@DaveFPM Yes, this can be taken as a new feature request for sure. 👍
Yes filtering on container tags would be great!
@mikhailkoliada I don't understand. If this doesn't filter by tags then what does it do? Tags !== versions?
To clarify, I'm trying to effectively purge my images to save space. I only need to keep main
, prod-base.*
and backend-build.*
. Can I not achieve this with the action in its current state?
May I suggest you please go through our marketplace documentation on how this input param works?
I just came to the same problem as Dave here. There is no mention in documentation anywhere that this action can not / will not parse container tags.
Could you add it please? Or even better merge #104
@nishthaGupta is this feature being worked on? It would be great for the official action to support containers since GHCR is part of GitHub packages. The change proposed in #104 seems to work and could simply be merged to resolve these issues. cc @cwille97, @jidicula who have merged PRs on this repo recently
It works fine, I made my own fork of actions/delete-package-versions
with #104 and #119 to gain access to these features and works as expected.
This is a surprising and annoying bug.
- It is not documented in the readme and
- There seems to be a PR that is meant to fix it open from one year ago but it hadn't landed for some reason
Can you please prioritize this as GHCR is an essential part many organizations workflow