From 274737b4d76ba3fce14f671ed93fc3d9bb84adc7 Mon Sep 17 00:00:00 2001 From: veenm Date: Sat, 22 Mar 2025 18:29:35 +0100 Subject: [PATCH] pipeline fix v8 --- .github/workflows/deploy-docker-to-tst.yml | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-docker-to-tst.yml b/.github/workflows/deploy-docker-to-tst.yml index 904a73b..85852e4 100644 --- a/.github/workflows/deploy-docker-to-tst.yml +++ b/.github/workflows/deploy-docker-to-tst.yml @@ -112,14 +112,14 @@ jobs: password: ${{ secrets.ALPINE_PASSWORD }} script: | VERSION=${{ env.VERSION }} - echo "Gekozen versie: $VERSION-SNAPSHOT" + echo "Gekozen versie: $VERSION" # Stop en verwijder de huidige container docker stop paypoint-backend || true docker rm paypoint-backend || true # Haal de nieuwste image binnen - docker pull veenm/paypoint-backend-jvm:$VERSION-SNAPSHOT + docker pull veenm/paypoint-backend-jvm:$VERSION # Start een nieuwe container docker run -d --name paypoint-backend --restart unless-stopped -p 15000:8080 \ @@ -134,8 +134,9 @@ jobs: -e MAILER_USERNAME=${{ secrets.MAILER_USERNAME }} \ -e MAILER_PASSWORD=${{ secrets.MAILER_PASSWORD }} \ veenm/paypoint-backend-jvm:$VERSION + - # Opruimen oude images + # Opruimen oude images docker image prune -f # Stap 4: Notify Mattermost via Bot (Build is geslaagd) @@ -150,3 +151,23 @@ jobs: "message": "@all ✅ *Build is geslaagd!* Versie '"$VERSION"' staat klaar op https://test-paypoint.melvanveen.nl" }' \ https://mattermost.melvanveen.nl/api/v4/posts + + notify-failure: + needs: [ build-and-push, deploy ] + runs-on: ubuntu-latest + if: failure() + + steps: + - name: Notify Mattermost via Bot on failure + env: + MATTERMOST_BOT_TOKEN: ${{ secrets.MATTERMOST_BOT_TOKEN }} + REPO: ${{ gitea.repository }} + BRANCH: ${{ gitea.ref }} + run: | + curl --fail -X POST -H "Authorization: Bearer $MATTERMOST_BOT_TOKEN" \ + -H 'Content-Type: application/json' \ + -d '{ + "channel_id": "9a8obynkd7rctk6qf8rfe6oppy", + "message": "@all ❌ *Build gefaald!* De pipeline is stukgelopen voor *'"$REPO"'* op branch *'"$BRANCH"'*." + }' \ + https://mattermost.melvanveen.nl/api/v4/posts