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

Remove preview docker images when closing PR #17

Closed
wants to merge 10 commits into from

Conversation

thomastvedt
Copy link
Contributor

@thomastvedt thomastvedt commented Feb 1, 2021

Closes #14

We're using GHCR - Github container registry which is currently in beta. I was planning to delete images using Github GraphQL API, but this is not supported yet by GHCR 😞

Delete container image (ghcr beta): https://docs.github.com/en/packages/guides/deleting-a-container-image

Quote:

You can remove an entire container image or a specific version on GitHub.   
To delete a container image, you must use the UI. Using  
GraphQL to delete a container image is not supported at this time.

To delete a container image, you must have admin permissions to the container image.

When deleting public packages, be aware that you may break projects that depend on your package.

No packages returned by Github API:
image

One last thing to try:
can we use standard docker commands to delete image?

=> nope...

Apparently this feature is coming soon, hopefully by the end of (last) month? 😉

https://github.community/t/are-there-plans-to-support-deletions-of-images-in-ghcr/153728

But we’re working on a delete API that could be used on PR merge. Hoping to have this out by end of month.

@ralftar :
I guess we'll just have to wait for this feature to be released? Or switch to another package registry? Or try to "hack it" using the same http requests as the Github UI (but I want to wait..)

@thomastvedt thomastvedt self-assigned this Feb 1, 2021
@ralftar
Copy link
Member

ralftar commented Feb 1, 2021

We'll wait 🐌

@thomastvedt
Copy link
Contributor Author

thomastvedt commented Mar 11, 2021

Update:
this is now released, but it sucks..

See this action for deleting packages:
https://github.com/marketplace/actions/delete-package-versions
but that is marked as unmaintained..: actions/delete-package-versions#36

Also it doesn't support deleting docker images:
actions/delete-package-versions#35

Perhaps this one is worth checking out?:
SmartsquareGmbH/delete-old-packages#5

Also another related bug:
https://github.community/t/github-container-registry-ghcr-io-packages-not-appearing-in-api/130133

When packages appear in api graphql response, we'll probably manage to delete them.

Conclusion for now:
Let's wait a bit longer.. Feature is still in preview, no extra costs yet?

@thomastvedt
Copy link
Contributor Author

@thomastvedt
Copy link
Contributor Author

@nikeee
Copy link

nikeee commented Mar 18, 2021

I'm facing the same problem and I'll probably use this:
https://github.com/marketplace/actions/delete-untagged-containers

Found via:
https://github.com/marketplace?type=actions&query=delete+container

* main:
  [Security] Bump redis from 3.0.2 to 3.1.2 (#31) skip ci
  [Security] Bump lodash from 4.17.19 to 4.17.21 (#33) skip ci
  [Security] Bump hosted-git-info from 2.8.5 to 2.8.9 (#34) skip ci
  Rename default preview namespace to preview
  remove preview url
  Thomastvedt/fix zero version (#30)
  Update index.js.map
  Change tag postfix format
  Thomastvedt/docker push fix (#28)
  Delete dependabot.yml
  Bump typescript from 4.1.3 to 4.1.4 (#27)
  Bump @typescript-eslint/parser from 4.14.2 to 4.15.0 (#25)
  Bump @types/node from 14.14.24 to 14.14.25 (#24)
  Add wait flag as default (#23)
  Update README.md
  Bump @typescript-eslint/parser from 4.14.1 to 4.14.2 (#18)
  Bump @types/node from 14.14.22 to 14.14.24 (#22)
  Add support for overriding extra helm values (#19)
  Bump eslint from 7.18.0 to 7.19.0 (#16)

# Conflicts:
#	action.yml
#	dist/index.js
#	dist/index.js.map
#	src/common.ts
#	src/main.ts
@thomastvedt
Copy link
Contributor Author

https://github.com/marketplace/actions/ghcr-delete-image

test this one?

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

Successfully merging this pull request may close these issues.

Remove docker images from docker image registry when closing PR
3 participants