-
Notifications
You must be signed in to change notification settings - Fork 133
feat(RELEASE-1989): python for publish-index-images tasks #2241
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
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,7 +64,8 @@ spec: | |
| securityContext: | ||
| runAsUser: 1001 | ||
| image: >- | ||
| quay.io/konflux-ci/release-service-utils@sha256:5546fa78d3c88d7b6a2e8cff8902f7757f00541d0bbaf113b9f293133894afa3 | ||
| quay.io/jluza/release-service-utils:RELEASE-1989 | ||
|
midnightercz marked this conversation as resolved.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: Fix when konflux-ci/release-service-utils#784 is merged |
||
| imagePullPolicy: Always | ||
|
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
|
||
| computeResources: | ||
|
midnightercz marked this conversation as resolved.
|
||
| limits: | ||
| memory: 64Mi | ||
|
|
@@ -74,52 +75,11 @@ spec: | |
| script: | | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| SOURCE_INDEX_CREDENTIAL="$(cat /mnt/publishingCredentials/sourceIndexCredential)" | ||
| TARGET_INDEX_CREDENTIAL="$(cat /mnt/publishingCredentials/targetIndexCredential)" | ||
|
|
||
| PATH=/bin:/usr/bin:/usr/local/bin | ||
| export PATH | ||
|
|
||
| SOURCE_AUTH_ARGS=() | ||
| if [[ ! "$(params.sourceIndex)" =~ ^registry-proxy(\-stage)?.engineering.redhat.com ]]; then | ||
| SOURCE_AUTH_ARGS=("--src-creds" "${SOURCE_INDEX_CREDENTIAL}") | ||
| fi | ||
|
|
||
| TARGET_AUTH_ARGS=("--dest-creds" "${TARGET_INDEX_CREDENTIAL}") | ||
|
|
||
| # Extract digest from pull spec | ||
| SOURCE_INDEX="$(params.sourceIndex)" | ||
| SOURCE_DIGEST="${SOURCE_INDEX##*@}" | ||
|
|
||
| echo "Getting target image digest: $(params.targetIndex)" | ||
| if TARGET_DIGEST=$(skopeo inspect \ | ||
| "docker://$(params.targetIndex)" \ | ||
| --format '{{.Digest}}' \ | ||
| --retry-times "$(params.retries)"); then | ||
| echo "Target image exists." | ||
| echo "DEBUG: Source Digest - $SOURCE_DIGEST" | ||
| echo "DEBUG: Target Digest - $TARGET_DIGEST" | ||
| if [ "$SOURCE_DIGEST" == "$TARGET_DIGEST" ]; then | ||
| echo "Image already exists with the same digest, skipping copy." | tee "$(results.requestMessage.path)" | ||
| exit 0 | ||
| else | ||
| echo "Image exists in target registry but digests do not match." \ | ||
| "Proceeding to copy the image." | ||
| fi | ||
| else | ||
| echo "Target image does not exist. Proceeding to copy the image." | ||
| fi | ||
|
|
||
| # Proceed with copying the image | ||
| echo "Copying image from $(params.sourceIndex) to $(params.targetIndex)" | ||
| (skopeo copy \ | ||
| --all \ | ||
| --preserve-digests \ | ||
| --retry-times "$(params.retries)" \ | ||
| --src-tls-verify=false "${SOURCE_AUTH_ARGS[@]}" \ | ||
| "docker://$(params.sourceIndex)" \ | ||
| "${TARGET_AUTH_ARGS[@]}" \ | ||
| "docker://$(params.targetIndex)" && \ | ||
| echo -n "Index Image Published successfully" || \ | ||
| echo -n "Error: Failed publishing Index Image" ) | tee "$(results.requestMessage.path)" | ||
| python3 -m publish_index_image \ | ||
|
midnightercz marked this conversation as resolved.
|
||
| --source-index "$(params.sourceIndex)" \ | ||
| --target-index "$(params.targetIndex)" \ | ||
| --retries "$(params.retries)" \ | ||
| --source-credential-path /mnt/publishingCredentials/sourceIndexCredential \ | ||
| --target-credential-path /mnt/publishingCredentials/targetIndexCredential | \ | ||
| awk '{printf "%s", (NR==1 ? "" : ORS) $0}' | \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might use instead the |
||
| tee "$(results.requestMessage.path)" | ||
|
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
midnightercz marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works, but I wonder if it would be cleaner to have the Python script write |
||
Uh oh!
There was an error while loading. Please reload this page.