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]
workflow_dispatch:
# Один runner (WSL): параллельные workflow ломают buildx/act.
concurrency:
group: eventhub-frontadmin-deploy-ift
cancel-in-progress: false
env:
REGISTRY: git.sabilin.com/eventhub
BUILDKIT_PROGRESS: quiet
@@ -13,13 +18,13 @@ env:
jobs:
deploy-ift-admin:
runs-on: ubuntu-latest
timeout-minutes: 60
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Compute image tag
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
with:
@@ -39,16 +44,27 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push admin-ui
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/eventhub-admin-ui:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/eventhub-admin-ui:ift
provenance: false
sbom: false
- name: Build admin-ui image
run: |
set -euo pipefail
bash scripts/retry-docker-build.sh 5 60 -- \
docker buildx build \
--network=host \
--file Dockerfile \
--tag eventhub-admin-ui:local \
--load \
--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
uses: appleboy/ssh-action@v0.1.5
@@ -59,4 +75,4 @@ jobs:
script: |
export REGISTRY_USER='${{ secrets.REGISTRY_USER }}'
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