From 850c23c1648afdafa71ae6c3d57554972d7963b0 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 6 Apr 2026 13:09:03 +0200 Subject: [PATCH] fix --- .github/workflows/cd-preprod.yml | 45 +++++++++++++++++++++++++++++--- .gitignore | 2 ++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-preprod.yml b/.github/workflows/cd-preprod.yml index 830f19c..1b8887e 100644 --- a/.github/workflows/cd-preprod.yml +++ b/.github/workflows/cd-preprod.yml @@ -217,22 +217,61 @@ jobs: NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} NEXT_PUBLIC_APP_URL=${{ secrets.NEXT_PUBLIC_APP_URL }} + build-log-exporter: + name: Build Log Exporter + runs-on: ubuntu-latest + needs: integration-tests + outputs: + sha: ${{ steps.sha.outputs.short }} + steps: + - uses: actions/checkout@v4 + - name: Short SHA + id: sha + run: echo "short=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: nologin + password: ${{ secrets.REGISTRY_TOKEN }} + - uses: docker/build-push-action@v5 + with: + context: ./apps/log-exporter + file: ./apps/log-exporter/Dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/xpeditis-log-exporter:preprod + ${{ env.REGISTRY }}/xpeditis-log-exporter:preprod-${{ steps.sha.outputs.short }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/xpeditis-log-exporter:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/xpeditis-log-exporter:buildcache,mode=max + platforms: linux/amd64,linux/arm64 + # ── 5. Deploy via Portainer ────────────────────────────────────────── deploy: name: Deploy to Preprod runs-on: ubuntu-latest - needs: [build-backend, build-frontend] + needs: [build-backend, build-frontend, build-log-exporter] environment: preprod steps: - name: Deploy backend run: | - curl -sf -X POST "${{ secrets.PORTAINER_WEBHOOK_BACKEND }}" + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${{ secrets.PORTAINER_WEBHOOK_BACKEND }}") + echo "Portainer response: HTTP $HTTP_CODE" + if [[ "$HTTP_CODE" != "2"* ]]; then + echo "ERROR: Portainer webhook failed with HTTP $HTTP_CODE" + exit 1 + fi echo "Backend webhook triggered." - name: Wait for backend startup run: sleep 20 - name: Deploy frontend run: | - curl -sf -X POST "${{ secrets.PORTAINER_WEBHOOK_FRONTEND }}" + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${{ secrets.PORTAINER_WEBHOOK_FRONTEND }}") + echo "Portainer response: HTTP $HTTP_CODE" + if [[ "$HTTP_CODE" != "2"* ]]; then + echo "ERROR: Portainer webhook failed with HTTP $HTTP_CODE" + exit 1 + fi echo "Frontend webhook triggered." # ── 6. Smoke Tests ─────────────────────────────────────────────────── diff --git a/.gitignore b/.gitignore index d8748a3..d74b04b 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,8 @@ lerna-debug.log* # Docker docker-compose.override.yml +stack-portainer.yaml +tmp.stack-portainer.yaml # Uploads uploads/