From 9c321dd481cf1f187b6d22344a61eaea7978474f Mon Sep 17 00:00:00 2001 From: mokjakA Date: Fri, 7 Nov 2025 18:34:23 +0900 Subject: [PATCH] =?UTF-8?q?feat(batch):=20DeployAndRunBatchJob.yml=20?= =?UTF-8?q?=EC=B5=9C=EC=A2=85=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/DeployAndRunBatchJob.yml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/DeployAndRunBatchJob.yml b/.github/workflows/DeployAndRunBatchJob.yml index 32ffc23..f6b7b19 100644 --- a/.github/workflows/DeployAndRunBatchJob.yml +++ b/.github/workflows/DeployAndRunBatchJob.yml @@ -133,6 +133,33 @@ jobs: envsubst < k8s/jobs/batch-job-template.yml > .out/job.yaml echo "--- Rendered manifest ---" cat .out/job.yaml + + - name: Wait for image to appear in registry (poll, short) + run: | + set -euo pipefail + IMAGE="${IMAGE_URI}" + echo "Checking image availability: $IMAGE" + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + + MAX_ATTEMPTS=36 # 36 * 5s = 180s (3 minutes) + ATTEMPT=0 + SLEEP=5 + + while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do + if docker manifest inspect "$IMAGE" >/dev/null 2>&1; then + echo "Image found: $IMAGE" + docker logout ghcr.io || true + exit 0 + fi + ATTEMPT=$((ATTEMPT+1)) + echo "Image not found yet (attempt $ATTEMPT/$MAX_ATTEMPTS). sleeping ${SLEEP}s..." + sleep $SLEEP + done + + docker logout ghcr.io || true + echo "ERROR: image $IMAGE not found after $((MAX_ATTEMPTS * SLEEP))s" + exit 1 + - name: Apply Job run: |