Skip to content

Commit

Permalink
dodocs: Expand warning
Browse files Browse the repository at this point in the history
Please enter the commit message for your changes. Lines starting
  • Loading branch information
sondrelg committed Sep 2, 2024
1 parent 7354876 commit 91bd2ee
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ makes sense in most cases.
- 👮 Supports multiple token types for authentication
- 🌱 The docker image used is sized below 10Mi, and the total runtime is a few seconds for most workloads

> [!WARNING]
> If you're building multi-arch images, see [Safely handling multi-platform/multi-arch images](#safely-handling-multi-platform-multi-arch-packages).
# Content

- [Usage](#usage)
Expand Down Expand Up @@ -335,7 +338,25 @@ The action will prioritize keeping newer package versions over older ones.

## Safely handling multi-platform (multi-arch) packages

This action (or rather, naïve deletion of package version in GitHub's container registry, in general) can break your multi-platform packages. If you're hosting multi-platform packages, please implement the action as described below.
This action (or rather, naïve deletion of package version in GitHub's container registry, in general) can break your images.

### How to know whether you're safe

Try and run the equivalent of this curl request:

```shell
curl -L \
-X GET \
-H "Accept: application/vnd.oci.image.index.v1+json" \
-H "Authorization: Bearer $(echo $PAT | base64)" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://ghcr.io/v2/snok%2Fcontainer-retention-policy/manifests/v3.0.0
```

> [!NOTE]
> The `%2F` is the percent-encoded value for `/`. Make sure you also url-encode any symbols that might need it from the package name or tag.
If the response has a `manifests` key with several elements, it is not recommended to use the action without implementing the workaround explained below:

### The problem

Expand Down
16 changes: 16 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,19 @@ run:
--timestamp-to-use "updated_at" \
--cut-off 1h \
--dry-run false

fetch-package-digests tag="v3.0.0":
curl -L \
-X GET \
-H "Accept: application/vnd.oci.image.index.v1+json" \
-H "Authorization: Bearer $(echo $DELETE_PACKAGES_CLASSIC_TOKEN | base64)" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://ghcr.io/v2/snok%2Fcontainer-retention-policy/manifests/{{ tag }}

test:
curl -L \
-X GET \
-H "Accept: application/vnd.oci.image.index.v1+json" \
-H "Authorization: Bearer $(echo $DELETE_PACKAGES_CLASSIC_TOKEN | base64)" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://ghcr.io/v2/snok%2Fcontainer-retention-policy/manifests/test-5-3

0 comments on commit 91bd2ee

Please sign in to comment.