-
Notifications
You must be signed in to change notification settings - Fork 373
Use staging token directly for production image copy source #757
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
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -381,21 +381,20 @@ jobs: | |||||||||
| production_image="${PRODUCTION_APP_NAME}:$((latest_number + 1))_${staging_commit}" | ||||||||||
| source_image_ref="${CPLN_ORG_STAGING}.registry.cpln.io/${STAGING_IMAGE}" | ||||||||||
|
|
||||||||||
| upstream_profile="upstream-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" | ||||||||||
| cleanup_upstream_profile() { | ||||||||||
| cpln profile delete "${upstream_profile}" >/dev/null 2>&1 || true | ||||||||||
| docker_config_dir="$(mktemp -d)" | ||||||||||
| cleanup_copy_credentials() { | ||||||||||
| rm -rf "${docker_config_dir}" | ||||||||||
| } | ||||||||||
| trap cleanup_upstream_profile EXIT | ||||||||||
| trap cleanup_copy_credentials EXIT | ||||||||||
|
|
||||||||||
| cleanup_upstream_profile | ||||||||||
| CPLN_TOKEN="${CPLN_TOKEN_STAGING}" cpln profile create "${upstream_profile}" >/dev/null | ||||||||||
| CPLN_PROFILE="${upstream_profile}" cpln image docker-login --org "${CPLN_ORG_STAGING}" >/dev/null | ||||||||||
| export DOCKER_CONFIG="${docker_config_dir}" | ||||||||||
|
|
||||||||||
| copy_status=1 | ||||||||||
| for attempt in $(seq 1 "${copy_image_attempts}"); do | ||||||||||
| if CPLN_PROFILE="${upstream_profile}" docker manifest inspect "${source_image_ref}" >/dev/null && | ||||||||||
| if CPLN_TOKEN="${CPLN_TOKEN_STAGING}" cpln image docker-login --org "${CPLN_ORG_STAGING}" >/dev/null && | ||||||||||
|
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. Re-running
Suggested change
Or at minimum, keep the current structure but drop the |
||||||||||
| docker manifest inspect "${source_image_ref}" >/dev/null && | ||||||||||
| CPLN_TOKEN="${CPLN_TOKEN_STAGING}" \ | ||||||||||
| cpln image copy "${STAGING_IMAGE}" \ | ||||||||||
| --profile "${upstream_profile}" \ | ||||||||||
| --org "${CPLN_ORG_STAGING}" \ | ||||||||||
| --to-profile default \ | ||||||||||
| --to-org "${CPLN_ORG_PRODUCTION}" \ | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOCKER_CONFIGis exported for the whole step, so any Docker commands that run after the loop (e.g. in the samerun:block if code is added later) will also use the temp dir — which will be cleaned up on EXIT. This is intentional and correct for isolation; just worth a comment so future editors don't wonder why the env var is set here instead of inline on eachdockercall.