Skip to content

Commit

Permalink
feat(ci): build image on push and send failure notification
Browse files Browse the repository at this point in the history
DEVOPS-77
  • Loading branch information
remdub committed Jun 29, 2024
1 parent c61fe57 commit 5c007d8
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Update images in Harbor
on:
schedule:
- cron: '0 5 * * 0' # Weekly on Sundays at 05:00
push:
branches:
- main
workflow_dispatch:
env:
IMAGE_NAME: teleservices/bookworm
Expand Down Expand Up @@ -60,7 +61,13 @@ jobs:
- name : Send notification on Mattermost
run: |
JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
MESSAGE="docker staging image has been updated on registry and the staging instance has been restarted. [Click here to see job on GitHub]($JOB_URL)"
MESSAGE="docker staging image $IMAGE_NAME has been updated on registry and the staging instance has been restarted. [Click here to see job on GitHub]($JOB_URL)"
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \"$MESSAGE\"}" ${{ secrets.TELESERVICES_MATTERMOST_WEBHOOK_URL }}
- name : Send failure notification on Mattermost
if: failure()
run: |
JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
MESSAGE="Error : docker staging image $IMAGE_NAME has not been updated on registry. [Click here to see job on GitHub]($JOB_URL)"
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \"$MESSAGE\"}" ${{ secrets.TELESERVICES_MATTERMOST_WEBHOOK_URL }}
production:
needs: [staging]
Expand Down Expand Up @@ -106,5 +113,11 @@ jobs:
- name : Send notification on Mattermost
run: |
JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
MESSAGE="docker prod image has been updated on registry. [Click here to see job on GitHub]($JOB_URL) A reboot of all production instances has been scheduled for tomorrow at 1am. "
MESSAGE="docker prod image $IMAGE_NAME has been updated on registry. [Click here to see job on GitHub]($JOB_URL) A reboot of all production instances has been scheduled for tomorrow at 1am. "
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \"$MESSAGE\"}" ${{ secrets.TELESERVICES_MATTERMOST_WEBHOOK_URL }}
- name : Send failure notification on Mattermost
if: failure()
run: |
JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
MESSAGE="Error : docker prod image $IMAGE_NAME has not been updated on registry. [Click here to see job on GitHub]($JOB_URL)"
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \"$MESSAGE\"}" ${{ secrets.TELESERVICES_MATTERMOST_WEBHOOK_URL }}

0 comments on commit 5c007d8

Please sign in to comment.