Skip to content

Commit

Permalink
Notify Slack when queue is up or down (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdemare authored Jul 11, 2024
1 parent 0426cd3 commit 6dfe753
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/test-rio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Check if RIO queue is up or down

on:
schedule:
- cron: '6 7-18 * * 1-5' # every hour on weekdays during working hours. Code will to a timezone check.
- cron: '6 7-18 * * 1-5' # every hour on weekdays during working hours. Code will do a timezone check.

jobs:
riotest:
rio_queue:
runs-on: ubuntu-latest

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
TRUSTSTORE_JKS_B64: ${{ secrets.TRUSTSTORE_JKS_B64 }}
run: |
echo "$KEYSTORE_JKS_B64" | base64 -d > keystore.jks
echo "$TRUSTSTORE_JKS_B64" | base64 -d > truststore.jks
echo "$TRUSTSTORE_JKS_B64" | base64 -d > truststore.jks
- name: Check rio queue status
env:
Expand All @@ -47,11 +47,28 @@ jobs:
RIO_SENDER_OIN: ${{ secrets.RIO_SENDER_OIN }}
RIO_RETRY_ATTEMPTS_SECONDS: '5,10,15'
RIO_UPDATE_URL: ${{ secrets.RIO_UPDATE_URL }}
SLACK_URL: ${{ secrets.SLACK_URL }}
STORE_HTTP_REQUESTS: true
SURF_CONEXT_CLIENT_ID: ${{ secrets.SURF_CONEXT_CLIENT_ID }}
SURF_CONEXT_CLIENT_SECRET: ${{ secrets.SURF_CONEXT_CLIENT_SECRET }}
SURF_CONEXT_INTROSPECTION_ENDPOINT: ${{ secrets.SURF_CONEXT_INTROSPECTION_ENDPOINT }}
TOKEN_ENDPOINT: ${{ secrets.TOKEN_ENDPOINT }}
TRUSTSTORE: truststore.jks
TRUSTSTORE_PASSWORD: ${{ secrets.TRUSTSTORE_PASSWORD }}
run: lein mapper test-rio rio-mapper-dev.jomco.nl cron
id: test_rio
run: |
lein mapper test-rio rio-mapper-dev.jomco.nl cron
echo "ERROR_STATUS=$?" >> "$GITHUB_OUTPUT"
continue-on-error: true
- name: Notify ok
if: ${{ steps.test_rio.outputs.ERROR_STATUS == 0 }}
run: |
curl -q -H "Content-Type: application/json" -X POST -d '{"text": "RIO Queue is UP"}' {{ $secrets.SLACK_URL }}
- name: Notify queue down
if: ${{ steps.test_rio.outputs.ERROR_STATUS == -1 }}
run: |
curl -q -H "Content-Type: application/json" -X POST -d '{"text": "RIO Queue is DOWN"}' {{ $secrets.SLACK_URL }}
- name: Notify error
if: ${{ steps.test_rio.outputs.ERROR_STATUS == -2 }}
run: |
curl -q -H "Content-Type: application/json" -X POST -d '{"text": "Error while checking RIO Queue"}' {{ $secrets.SLACK_URL }}

0 comments on commit 6dfe753

Please sign in to comment.