CI: build-once pipeline, deploy IFT after CI with conditional aux images.
CI / test (push) Failing after 8m2s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-10 12:55:01 +03:00
parent 8f28de1461
commit 9b48b165ba
4 changed files with 104 additions and 50 deletions
+19
View File
@@ -13,6 +13,7 @@ concurrency:
env:
BUILDKIT_PROGRESS: quiet
DOCKER_BUILDKIT: 1
REGISTRY: git.sabilin.com/eventhub
jobs:
test:
@@ -46,3 +47,21 @@ jobs:
- name: Run API tests (local CT)
run: docker run --rm eventhub-api-tests:latest
- name: Login to registry
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
registry: git.sabilin.com
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push tested eventhub image
if: github.event_name == 'push'
run: |
set -euo pipefail
TAG="sha-${GITHUB_SHA:0:12}"
docker tag eventhub:latest "${REGISTRY}/eventhub:${TAG}"
docker tag eventhub:latest "${REGISTRY}/eventhub:ift"
docker push "${REGISTRY}/eventhub:${TAG}"
docker push "${REGISTRY}/eventhub:ift"
+39 -49
View File
@@ -1,12 +1,14 @@
name: Deploy IFT (core)
on:
push:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master, main]
workflow_dispatch:
concurrency:
group: eventhub-back-${{ github.ref }}
group: eventhub-back-deploy-ift
cancel-in-progress: false
env:
@@ -16,14 +18,27 @@ env:
jobs:
deploy-ift-core:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
fetch-depth: 2
- name: Compute image tag
id: meta
run: echo "tag=sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_run" ]; then
SHA="${{ github.event.workflow_run.head_sha }}"
else
SHA="${GITHUB_SHA}"
fi
echo "tag=sha-${SHA:0:12}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -35,53 +50,28 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push eventhub
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/eventhub:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/eventhub:ift
provenance: false
sbom: false
- name: Verify eventhub image from CI
run: |
set -euo pipefail
TAG="${{ steps.meta.outputs.tag }}"
if ! docker buildx imagetools inspect "${REGISTRY}/eventhub:${TAG}" >/dev/null 2>&1; then
echo "Образ eventhub:${TAG} не найден — сначала должен пройти CI (build + test + push)."
exit 1
fi
echo "OK: eventhub:${TAG} (из CI, без пересборки)"
- name: Build and push traefik-coraza
uses: docker/build-push-action@v5
with:
context: docker/traefik
file: docker/traefik/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/traefik-coraza:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/traefik-coraza:ift
provenance: false
sbom: false
- name: Build and push fallback
uses: docker/build-push-action@v5
with:
context: docker/fallback
file: docker/fallback/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/fallback:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/fallback:ift
provenance: false
sbom: false
- name: Build and push bot-emulator
uses: docker/build-push-action@v5
with:
context: .
file: test/emulate_users/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/bot-emulator-users:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/bot-emulator-users:ift
provenance: false
sbom: false
# Вспомогательные образы Back: rebuild при изменениях, иначе promote :ift -> sha-*.
- name: Publish auxiliary images
run: |
set -euo pipefail
TAG="${{ steps.meta.outputs.tag }}"
if [ "${{ github.event_name }}" = "workflow_run" ]; then
HEAD="${{ github.event.workflow_run.head_sha }}"
else
HEAD="${GITHUB_SHA}"
fi
FILES="$(git diff --name-only "${HEAD}^" "${HEAD}" 2>/dev/null || git show --pretty="" --name-only "${HEAD}")"
bash scripts/publish-ift-aux-images.sh "${REGISTRY}" "${TAG}" "${FILES}"
- name: Deploy core on IFT via SSH
uses: appleboy/ssh-action@v0.1.5
+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
set -euo pipefail
SHA="${{ steps.meta.outputs.sha_tag }}"
REL="${{ steps.meta.outputs.release_tag }}"
IMAGES="eventhub traefik-coraza fallback bot-emulator-users"
IMAGES="eventhub traefik-coraza fallback bot-emulator-users observer-web logrotate"
missing=""
for img in ${IMAGES}; do
if ! docker buildx imagetools inspect "${REGISTRY}/${img}:${SHA}" >/dev/null 2>&1; then