61d45b318d
CI разбит на test + push-image; deploy-ift проверяет образ в registry. Gate-шаги ловят незавершённый job (exit -1 / context canceled). Co-authored-by: Cursor <cursoragent@cursor.com>
68 lines
2.1 KiB
YAML
68 lines
2.1 KiB
YAML
name: Deploy IFT (admin)
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [CI]
|
|
types: [completed]
|
|
branches: [master, main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: eventhub-frontadmin-deploy-ift
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
REGISTRY: git.sabilin.com/eventhub
|
|
|
|
jobs:
|
|
deploy-ift-admin:
|
|
if: |
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Compute image tag
|
|
id: meta
|
|
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: Wait for Docker daemon
|
|
run: bash scripts/ensure-docker-daemon.sh 240
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: git.sabilin.com
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Verify admin-ui image from CI
|
|
run: |
|
|
set -euo pipefail
|
|
TAG="${{ steps.meta.outputs.tag }}"
|
|
if ! docker buildx imagetools inspect "${REGISTRY}/eventhub-admin-ui:${TAG}" >/dev/null 2>&1; then
|
|
echo "Образ eventhub-admin-ui:${TAG} не найден — CI push не завершился (ложный success runner?)."
|
|
exit 1
|
|
fi
|
|
echo "OK: eventhub-admin-ui:${TAG}"
|
|
|
|
- name: Deploy admin on IFT via SSH
|
|
uses: appleboy/ssh-action@v0.1.5
|
|
with:
|
|
host: ${{ secrets.IFT_SSH_HOST }}
|
|
username: ${{ secrets.IFT_SSH_USER }}
|
|
key: ${{ secrets.IFT_SSH_PRIVATE_KEY }}
|
|
script: |
|
|
export REGISTRY_USER='${{ secrets.REGISTRY_USER }}'
|
|
export REGISTRY_PASSWORD='${{ secrets.REGISTRY_PASSWORD }}'
|
|
bash /opt/eventhub-ift/devops/scripts/deploy-service.sh ift admin ${{ steps.meta.outputs.tag }}
|