Repository navigation
ci(eng-prod): mirror the sd shard redis images to ghcr [CLK-1591713] #7
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Mirror Images | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - docker/mirror-images.txt | ||
| - .github/workflows/mirror-images.yml | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - docker/mirror-images.txt | ||
| - .github/workflows/mirror-images.yml | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| # Copies every image in docker/mirror-images.txt from Docker Hub to | ||
| # ghcr.io/<owner>/mirror/<path>:<tag>, byte-for-byte (same digest, all | ||
| # platforms). Same model as push-images in ci.yml: the built-in GITHUB_TOKEN | ||
| # with packages: write, no registry PAT, and on pull_request events nothing is | ||
| # pushed, only checked. The pinned digest is what gets copied, so a tag that | ||
| # moves upstream only raises a warning. | ||
| mirror-images: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| env: | ||
| MIRROR_PREFIX: ghcr.io/${{ github.repository_owner }}/mirror | ||
| steps: | ||
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | ||
| - name: Log in to GHCR | ||
| if: github.event_name != 'pull_request' | ||
| run: | | ||
| echo "${{ secrets.GITHUB_TOKEN }}" | | ||
| skopeo login ghcr.io --username "${{ github.actor }}" --password-stdin | ||
| - name: Check or copy each image | ||
| run: | | ||
| set -euo pipefail | ||
| grep -Ev '^[[:space:]]*(#|$)' docker/mirror-images.txt | while read -r line; do | ||
| ref="${line%@*}" | ||
| digest="${line#*@}" | ||
| source="docker://docker.io/${ref%:*}@$digest" | ||
| skopeo inspect --raw "$source" > /dev/null | ||
| tag_digest="$(skopeo inspect --raw "docker://docker.io/$ref" | sha256sum | cut -d' ' -f1)" | ||
| if [[ "sha256:$tag_digest" != "$digest" ]]; then | ||
| echo "::warning::$ref now resolves to sha256:$tag_digest, not the pinned $digest; the pinned digest is still what gets mirrored." | ||
| fi | ||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| echo "ok $ref@$digest" | ||
| continue | ||
| fi | ||
| dest="docker://$MIRROR_PREFIX/$ref" | ||
| skopeo copy --all --preserve-digests "$source" "$dest" | ||
| mirrored="sha256:$(skopeo inspect --raw "$dest" | sha256sum | cut -d' ' -f1)" | ||
| if [[ "$mirrored" != "$digest" ]]; then | ||
| echo "::error::$MIRROR_PREFIX/$ref has digest $mirrored after the copy, expected $digest." | ||
| exit 1 | ||
| fi | ||
| echo "mirrored $MIRROR_PREFIX/$ref@$digest" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Third-party images mirrored to ghcr.io/<owner>/mirror/<path>:<tag> by | ||
| # .github/workflows/mirror-images.yml, so self-hosted runners pull them from | ||
| # GHCR instead of anonymously from Docker Hub. | ||
| # | ||
| # One image per line: <Docker Hub path>:<tag>@<digest>. The digest pins what is | ||
| # copied; the mirror keeps the same digest, so consumers can pin it too. | ||
| bitnamilegacy/redis-cluster:6.2.16@sha256:d973a2aa8b6688190ca4e4544b2ff859ef1e9f8081518558270df34e23ff1df7 | ||
| bitnamilegacy/redis:6.2.16@sha256:116419dc09f37b2c37e47e1a2cef258620ca1a30bae379b3660cf78fc0e7fc99 | ||
| library/alpine:3.21@sha256:ce64758a109eb420d874a118f87920e625e12d3634e03b4a5573fd9f6e5d3507 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.