-
Notifications
You must be signed in to change notification settings - Fork 4
Add image mirroring support #139
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 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1e6af16
Add image mirroring support
sarahchen6 69469ea
Tag images with ci- prefix instead
sarahchen6 5513dfc
Add workflows that create images PRs
sarahchen6 0805c51
Separate out ci- tagging logic
sarahchen6 d11eb1a
Merge branch 'master' into sarahchen6/mirror-images
sarahchen6 8e3e105
Re-organize scripts
sarahchen6 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
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,109 @@ | ||
| #!/usr/bin/env bash | ||
| # In order to test the images built by your PR in dd-trace-java CI, the images must first be mirrored into the DataDog/images repo. | ||
| # Use this script to generate the YAML snippets that need to be added to mirror.yaml and mirror.lock.yaml in DataDog/images. | ||
| # Before running, ensure that the expected images are available here: https://github.com/DataDog/dd-trace-java-docker-build/pkgs/container/dd-trace-java-docker-build. | ||
| # | ||
| # Usage: | ||
| # ./scripts/generate-test-image-yaml.sh <PR_NUM> | ||
| # | ||
| # Example: | ||
| # ./scripts/generate-test-image-yaml.sh 138 | ||
| # | ||
| # Requires: | ||
| # crane (install with `brew install crane`) | ||
| set -euo pipefail | ||
|
|
||
| readonly SOURCE_REPO="ghcr.io/datadog/dd-trace-java-docker-build" | ||
|
|
||
| readonly CI_VARIANTS=( | ||
| base | ||
| 7 | ||
| 8 | ||
| 11 | ||
| 17 | ||
| 21 | ||
| 25 | ||
| tip | ||
| zulu8 | ||
| zulu11 | ||
| oracle8 | ||
| ibm8 | ||
| semeru8 | ||
| semeru11 | ||
| semeru17 | ||
| graalvm17 | ||
| graalvm21 | ||
| graalvm25 | ||
| ) | ||
|
|
||
| if [[ $# -ne 1 ]]; then | ||
| echo "Usage: $0 <PR_NUM>" >&2 | ||
| echo "Example: $0 138" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| PR_NUM="$1" | ||
| if ! [[ "$PR_NUM" =~ ^[0-9]+$ ]]; then | ||
| echo "Error: PR_NUM must be a number (got: '$PR_NUM')" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v crane &>/dev/null; then | ||
| echo "Error: 'crane' is required but not found. Install with 'brew install crane'." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| readonly PREFIX="${PR_NUM}_merge-" | ||
|
|
||
| echo "Resolving digests for ${#CI_VARIANTS[@]} variants (prefix: '${PREFIX}')..." >&2 | ||
|
|
||
| declare -A DIGESTS | ||
| for variant in "${CI_VARIANTS[@]}"; do | ||
| tag="${PREFIX}${variant}" | ||
| echo -n " ${tag} ... " >&2 | ||
| digest="$(crane digest "${SOURCE_REPO}:${tag}")" | ||
| DIGESTS["$variant"]="$digest" | ||
| echo "$digest" >&2 | ||
| done | ||
|
|
||
| echo "" >&2 | ||
|
|
||
| cat <<EOF | ||
| ### Add to https://github.com/DataDog/images/blob/master/mirror.yaml: | ||
|
|
||
| EOF | ||
|
|
||
| for variant in "${CI_VARIANTS[@]}"; do | ||
| tag="${PREFIX}${variant}" | ||
| cat <<EOF | ||
| - source: "${SOURCE_REPO}:${tag}" | ||
| dest: | ||
| repo: "dd-trace-java-docker-build" | ||
| tag: "${tag}" | ||
| replication_target: "" | ||
| renovate: | ||
| enabled: true | ||
| EOF | ||
| done | ||
|
|
||
| cat <<EOF | ||
|
|
||
| ### Add to https://github.com/DataDog/images/blob/master/mirror.lock.yaml: | ||
|
|
||
| EOF | ||
|
|
||
| for variant in "${CI_VARIANTS[@]}"; do | ||
| tag="${PREFIX}${variant}" | ||
| cat <<EOF | ||
| # renovate | ||
| - source: ${SOURCE_REPO}:${tag} | ||
| digest: ${DIGESTS[$variant]} | ||
| EOF | ||
| done | ||
|
|
||
| cat <<EOF | ||
|
|
||
| ### Set in https://github.com/DataDog/dd-trace-java/blob/master/.gitlab-ci.yml: | ||
|
|
||
| TESTER_IMAGE_VERSION_PREFIX: "${PREFIX}" | ||
| EOF |
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.