Skip to content

Commit 6005ecf

Browse files
committed
fix: parse registry_info CLI output without shell expansion
The previous registry_info.sh ran `echo $REGISTRY_INFO > registry_info.env` followed by `source registry_info.env`, both of which re-expand any `$` in the value. Harbor robot usernames are `robot$<project>+push`, so `$<project>` was being treated as an unset shell variable and dropped, leaving `robot-<rest>+push` — which Harbor rejects with 401 at docker login. Read each KEY=VALUE pair via `read -r`, which preserves the literal `$`, and set the env vars from the captured variables. Also convert actions/utils/registry_info/action.yml from a docker action to a composite action, so the fixed script in this branch is used at run time instead of the version baked into the published image.
1 parent 72357c6 commit 6005ecf

2 files changed

Lines changed: 39 additions & 5 deletions

File tree

actions/utils/registry_info/action.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ inputs:
1111
required: false
1212
description: "Alternative to providing organization ID. The URL of your Dagster Cloud organization."
1313
runs:
14-
using: "docker"
15-
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:1.12.17"
16-
entrypoint: "/registry_info.sh"
14+
# Composite (not docker) so the fixed registry_info.sh from this branch is
15+
# used directly, not the version baked into the published image. The script
16+
# avoids `source` and unquoted `echo` so a `$` in the username (Harbor robot
17+
# accounts: robot$<project>+push) survives shell expansion.
18+
using: "composite"
19+
steps:
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Install dagster-cloud CLI
26+
shell: bash
27+
run: python -m pip install --quiet dagster-cloud-cli
28+
29+
- name: Fetch registry info
30+
shell: bash
31+
env:
32+
INPUT_ORGANIZATION_ID: ${{ inputs.organization_id }}
33+
INPUT_DEPLOYMENT: ${{ inputs.deployment }}
34+
INPUT_DAGSTER_CLOUD_URL: ${{ inputs.dagster_cloud_url }}
35+
run: bash ${{ github.action_path }}/../../../src/registry_info.sh

src/registry_info.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,23 @@ while (( !AWS_ECR_PASSWORD && count < 6 )); do
1515
REGISTRY_INFO=$(dagster-cloud serverless registry-info \
1616
--url "${DAGSTER_CLOUD_URL}/${INPUT_DEPLOYMENT}" \
1717
--api-token "$DAGSTER_CLOUD_API_TOKEN")
18-
echo $REGISTRY_INFO > registry_info.env
19-
source registry_info.env
18+
# Parse KEY=VALUE pairs without `source` or unquoted `echo`, because
19+
# either would re-expand any `$` in the value (e.g. Harbor robot
20+
# usernames are `robot$<project>+push`) and mangle the credential.
21+
AWS_ECR_USERNAME=""
22+
AWS_ECR_PASSWORD=""
23+
REGISTRY_URL=""
24+
AWS_DEFAULT_REGION=""
25+
CUSTOM_BASE_IMAGE_ALLOWED=""
26+
while IFS='=' read -r _key _value; do
27+
case "$_key" in
28+
AWS_ECR_USERNAME) AWS_ECR_USERNAME="$_value" ;;
29+
AWS_ECR_PASSWORD) AWS_ECR_PASSWORD="$_value" ;;
30+
REGISTRY_URL) REGISTRY_URL="$_value" ;;
31+
AWS_DEFAULT_REGION) AWS_DEFAULT_REGION="$_value" ;;
32+
CUSTOM_BASE_IMAGE_ALLOWED) CUSTOM_BASE_IMAGE_ALLOWED="$_value" ;;
33+
esac
34+
done <<<"$REGISTRY_INFO"
2035
count=$(($count + 1))
2136
if [ ! -z "$AWS_ECR_PASSWORD" ]; then
2237
echo "Loaded registry information."

0 commit comments

Comments
 (0)