From 1eb0f8f35068aeb0a8fab393cd7b6316885cbb02 Mon Sep 17 00:00:00 2001 From: Seasons Change <1204992313@qq.com> Date: Wed, 11 Nov 2026 12:11:14 +0800 Subject: [PATCH] ci: pass only the image version between jobs GitHub Actions drops job outputs that contain a secret value, and the image reference contains DOCKER_USERNAME, so the deploy job received an empty IMAGE and stopped at the pre-pull step (the running gateway was not touched). Output the version only, build the image reference in the deploy job, and fail fast if it is malformed. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/deploy.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 3cb45a97..1f0fac76 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -46,7 +46,8 @@ jobs: needs: build runs-on: ubuntu-latest outputs: - image: ${{ steps.meta.outputs.image }} + # Only the version: an output containing a secret value (DOCKER_USERNAME) is dropped by Actions. + version: ${{ steps.meta.outputs.version }} steps: - uses: actions/checkout@v5 with: @@ -64,6 +65,7 @@ jobs: run: | version="$(date -u +%Y%m%d%H%M)-${GITHUB_SHA::7}" image="docker.io/${DOCKER_USERNAME}/higress-console:${version}" + echo "version=$version" >> "$GITHUB_OUTPUT" echo "image=$image" >> "$GITHUB_OUTPUT" echo "Image: \`$image\`" >> "$GITHUB_STEP_SUMMARY" @@ -89,7 +91,7 @@ jobs: # Production runs on the K3s cluster (k3s.seasonschange.cn), namespace higress. # KUBE_CONFIG is a kubeconfig for the namespace-scoped ServiceAccount higress/ci-deployer. NAMESPACE: higress - IMAGE: ${{ needs.image.outputs.image }} + IMAGE: docker.io/${{ secrets.DOCKER_USERNAME }}/higress-console:${{ needs.image.outputs.version }} PUBLIC_URL: https://mcp.tmlab.top steps: - uses: actions/checkout@v5 @@ -101,6 +103,7 @@ jobs: KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} run: | set -euo pipefail + [[ "$IMAGE" =~ ^docker\.io/[a-z0-9._-]+/higress-console:[0-9]{12}-[0-9a-f]{7}$ ]] || { echo "::error::Bad image reference: '$IMAGE'"; exit 1; } [[ -n "$KUBE_CONFIG" ]] || { echo "::error::Repository secret KUBE_CONFIG is required."; exit 1; } install -m 700 -d ~/.kube printf '%s\n' "$KUBE_CONFIG" > ~/.kube/config