CI: robust admin docker build/push on WSL runner.
CI / test (push) Failing after 1m7s
Deploy IFT (admin) / deploy-ift-admin (push) Failing after 1m30s

Use build --load with network=host and retry script like EventHubBack; add deploy concurrency group and 90m timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-10 22:07:34 +03:00
parent 4b286321d4
commit e6c7e65982
2 changed files with 63 additions and 13 deletions
+29 -13
View File
@@ -5,6 +5,11 @@ on:
branches: [master, main] branches: [master, main]
workflow_dispatch: workflow_dispatch:
# Один runner (WSL): параллельные workflow ломают buildx/act.
concurrency:
group: eventhub-frontadmin-deploy-ift
cancel-in-progress: false
env: env:
REGISTRY: git.sabilin.com/eventhub REGISTRY: git.sabilin.com/eventhub
BUILDKIT_PROGRESS: quiet BUILDKIT_PROGRESS: quiet
@@ -13,13 +18,13 @@ env:
jobs: jobs:
deploy-ift-admin: deploy-ift-admin:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 90
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Compute image tag - name: Compute image tag
id: meta id: meta
run: echo "tag=sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT" run: echo "tag=sha-${GITHUB_SHA:0:12}" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
@@ -39,16 +44,27 @@ jobs:
username: ${{ secrets.REGISTRY_USER }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push admin-ui - name: Build admin-ui image
uses: docker/build-push-action@v5 run: |
with: set -euo pipefail
context: . bash scripts/retry-docker-build.sh 5 60 -- \
push: true docker buildx build \
tags: | --network=host \
${{ env.REGISTRY }}/eventhub-admin-ui:${{ steps.meta.outputs.tag }} --file Dockerfile \
${{ env.REGISTRY }}/eventhub-admin-ui:ift --tag eventhub-admin-ui:local \
provenance: false --load \
sbom: false --provenance=false \
--sbom=false \
.
- name: Push admin-ui image
run: |
set -euo pipefail
TAG="${{ steps.meta.outputs.tag }}"
docker tag eventhub-admin-ui:local "${REGISTRY}/eventhub-admin-ui:${TAG}"
docker tag eventhub-admin-ui:local "${REGISTRY}/eventhub-admin-ui:ift"
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub-admin-ui:${TAG}"
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub-admin-ui:ift"
- name: Deploy admin on IFT via SSH - name: Deploy admin on IFT via SSH
uses: appleboy/ssh-action@v0.1.5 uses: appleboy/ssh-action@v0.1.5
@@ -59,4 +75,4 @@ jobs:
script: | script: |
export REGISTRY_USER='${{ secrets.REGISTRY_USER }}' export REGISTRY_USER='${{ secrets.REGISTRY_USER }}'
export REGISTRY_PASSWORD='${{ secrets.REGISTRY_PASSWORD }}' export REGISTRY_PASSWORD='${{ secrets.REGISTRY_PASSWORD }}'
/opt/eventhub-ift/devops/scripts/deploy-service.sh ift admin ${{ steps.meta.outputs.tag }} bash /opt/eventhub-ift/devops/scripts/deploy-service.sh ift admin ${{ steps.meta.outputs.tag }}
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Retry docker/buildx commands on transient network/registry failures.
# Usage: retry-docker-build.sh [max_attempts] [wait_seconds] -- <command...>
set -euo pipefail
MAX="${1:-3}"
WAIT="${2:-30}"
shift 2
[[ "${1:-}" == "--" ]] && shift
if [[ $# -eq 0 ]]; then
echo "Usage: $0 [max_attempts] [wait_seconds] -- <command...>" >&2
exit 2
fi
attempt=1
while true; do
echo "== docker build attempt ${attempt}/${MAX}: $*"
set +e
"$@"
code=$?
set -e
if (( code == 0 )); then
exit 0
fi
if (( attempt >= MAX )); then
echo "== all ${MAX} attempts failed (last exit ${code})"
exit "${code}"
fi
echo "== attempt ${attempt} failed (exit ${code}), retry in ${WAIT}s..."
docker buildx prune -f >/dev/null 2>&1 || true
sleep "${WAIT}"
attempt=$((attempt + 1))
done