fix(ci): harbor login mangled username and added newline to password

Pass HARBOR_USERNAME/HARBOR_PASSWORD via env: instead of inlining
${{ secrets.* }} directly into the shell — bash was expanding the `$`
in the robot username (e.g. `robot$kollect-tools+...` lost the
`$kollect-tools` segment). Switched echo to printf to avoid appending a
newline to --password-stdin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
main
Fadhli Azhari 2026-05-14 09:45:39 +08:00
parent 8376250940
commit a2e78b8fbd
1 changed files with 10 additions and 3 deletions

View File

@ -67,10 +67,17 @@ jobs:
echo "tag_latest=${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT" echo "tag_latest=${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
- name: Login to Harbor - name: Login to Harbor
# Pass secrets via env (not ${{ }} inlining) so shell quoting can't
# mangle them — e.g. a literal `$` in the robot username would be
# expanded by bash if inlined inside double quotes. printf (not echo)
# avoids appending a newline to the password sent to --password-stdin.
env:
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
run: | run: |
echo "${{ secrets.HARBOR_PASSWORD }}" \ printf '%s' "$HARBOR_PASSWORD" \
| docker login "${{ env.HARBOR_REGISTRY }}" \ | docker login "$HARBOR_REGISTRY" \
-u "${{ secrets.HARBOR_USERNAME }}" \ -u "$HARBOR_USERNAME" \
--password-stdin --password-stdin
- name: Build image - name: Build image