From 0888c72455aabf67c73654545dbd6b8cf387f284 Mon Sep 17 00:00:00 2001 From: Rdiss03 Date: Tue, 26 Nov 2024 19:10:00 +0100 Subject: [PATCH] integrating slack webhook to my cd github actions workflow --- .../backend_guess_logic_number_cd.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/backend_guess_logic_number_cd.yml b/.github/workflows/backend_guess_logic_number_cd.yml index 0894040..0a50e8f 100644 --- a/.github/workflows/backend_guess_logic_number_cd.yml +++ b/.github/workflows/backend_guess_logic_number_cd.yml @@ -28,6 +28,11 @@ jobs: run: working-directory: . steps: + - name: Send Setup postgres news to slack + run: > + curl -X POST -H 'Content-type: application/json' + --data '{"text":"Le conteneur :container: postgres est configuré dans notre runner(ubuntu-latest) pour repondre aux besoins du job du workflow"}' + ${{ secrets.SLACK_WEBHOOK_URL }} - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: @@ -48,6 +53,11 @@ jobs: - name: run unit and integration test and Build app docker image and replacing image tag with build_number value and Push to dockerhub run: mvn -ntp -B verify -Ddocker.image.tag=${{steps.build-number.outputs.BUILD_NUMBER}} jib:build + - name: Send maven command news to slack + run: > + curl -X POST -H 'Content-type: application/json' + --data '{"text":"le projet build, maven :maven: a compile le code , a run les TUs et TIs et a build puis push limage docker de notre code sur dockerhub a laide de jib qui se sert du jar :smile: "}' + ${{ secrets.SLACK_WEBHOOK_URL }} - name: Update Dockerrun.aws.json with the newest application image tag which is build number run: | echo "Dockerrun.aws.json before updating tag" @@ -68,6 +78,12 @@ jobs: region: ${{ secrets.AWS_EB_REGION }} deployment_package: Dockerrun.aws.json + - name: Send deployment to AWS news with AWS Elastic Beanstalk to slack + run: > + curl -X POST -H 'Content-type: application/json' + --data '{"text":"le deploiement sur AWS :aws: est termine "}' + ${{ secrets.SLACK_WEBHOOK_URL }} + - name: Commit and push Dockerrun.aws.json to our github repo run: | git config user.name github actions @@ -75,3 +91,15 @@ jobs: git add . git commit -m "Update Dockerrun.aws.json specifically our docker app image with new tag ${{steps.build-number.outputs.BUILD_NUMBER}}" git push + + - name: Send commit and push news to slack + run: > + curl -X POST -H 'Content-type: application/json' + --data '{"text":"le code avec la modif sur le fichier Dockerrun.aws.json a ete bien commit et push :git-push: sur main par le user github actions"}' + ${{ secrets.SLACK_WEBHOOK_URL }} + - name: Send last message to slack + if: always() + run: > + curl -X POST -H 'Content-type: application/json' + --data '{"text":"Job Status ${{ job.status }} :end:"}' + ${{ secrets.SLACK_WEBHOOK_URL }}