Skip to content

Commit c6c4055

Browse files
committed
fix(ci): use org-level secrets instead of KMS fetch for DockerHub
KMS universal-auth endpoint returns 404 from in-cluster CI runners due to ingress routing. DOCKERHUB_USERNAME and DOCKERHUB_TOKEN are already available as org-level GitHub secrets.
1 parent 070a5db commit c6c4055

File tree

1 file changed

+2
-35
lines changed

1 file changed

+2
-35
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,6 @@ jobs:
2626
id: sha
2727
run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
2828

29-
- name: Fetch CI secrets from Hanzo KMS
30-
id: kms
31-
env:
32-
KMS_CLIENT_ID: ${{ secrets.KMS_CLIENT_ID }}
33-
KMS_CLIENT_SECRET: ${{ secrets.KMS_CLIENT_SECRET }}
34-
run: |
35-
set -euo pipefail
36-
KMS_URL="${KMS_URL:-https://kms.hanzo.ai}"
37-
38-
ACCESS_TOKEN="$(
39-
curl -fsS -X POST "${KMS_URL}/api/v1/auth/universal-auth/login" \
40-
-H "Content-Type: application/json" \
41-
-d "$(jq -nc --arg cid "$KMS_CLIENT_ID" --arg cs "$KMS_CLIENT_SECRET" \
42-
'{clientId: $cid, clientSecret: $cs}')" \
43-
| jq -r '.accessToken'
44-
)"
45-
46-
[ -n "${ACCESS_TOKEN}" ] && [ "${ACCESS_TOKEN}" != "null" ] || {
47-
echo "::error::Failed to authenticate to Hanzo KMS"; exit 1; }
48-
49-
fetch_secret() {
50-
curl -fsS "${KMS_URL}/api/v3/secrets/raw/${1}?workspaceSlug=gitops&environment=prod&secretPath=/ci&viewSecretValue=true&include_imports=true" \
51-
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
52-
| jq -r '.secret.secretValue'
53-
}
54-
55-
for name in DOCKERHUB_USERNAME DOCKERHUB_TOKEN; do
56-
val="$(fetch_secret "$name")"
57-
[ -n "$val" ] && [ "$val" != "null" ] || { echo "::error::Missing KMS secret $name"; exit 1; }
58-
echo "::add-mask::${val}"
59-
echo "${name}=${val}" >> "$GITHUB_OUTPUT"
60-
done
61-
6229
- name: Set up QEMU
6330
uses: docker/setup-qemu-action@v3
6431

@@ -77,8 +44,8 @@ jobs:
7744
continue-on-error: true
7845
with:
7946
registry: docker.io
80-
username: ${{ steps.kms.outputs.DOCKERHUB_USERNAME }}
81-
password: ${{ steps.kms.outputs.DOCKERHUB_TOKEN }}
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_TOKEN }}
8249

8350
- name: Image metadata
8451
id: meta

0 commit comments

Comments
 (0)