Skip to content

Commit

Permalink
Adding error detection around the k8s rollout (#2145)
Browse files Browse the repository at this point in the history
* adding error detection around the k8s rollout

* fixing for shellcheck
  • Loading branch information
ben851 authored Mar 21, 2024
1 parent da922e1 commit 4531e5e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ jobs:
- name: Rollout in Kubernetes
run: |
PAYLOAD={\"ref\":\"main\",\"inputs\":{\"docker_sha\":\"${GITHUB_SHA::7}\"}}
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $WORKFLOW_PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/cds-snc/notification-manifests/actions/workflows/api-rollout-k8s-staging.yaml/dispatches \
-d $PAYLOAD
./scripts/callManifestsRollout.sh ${GITHUB_SHA::7}
- name: my-app-install token
id: notify-pr-bot
Expand Down
17 changes: 17 additions & 0 deletions scripts/callManifestsRollout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
GITHUB_SHA=$1
PAYLOAD="{\"ref\":\"main\",\"inputs\":{\"docker_sha\":\"$GITHUB_SHA\"}}"


RESPONSE=$(curl -w '%{http_code}\n' \
-o /dev/null -s \
-L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $WORKFLOW_PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/cds-snc/notification-manifests/actions/workflows/api-rollout-k8s-staging.yaml/dispatches \
-d "$PAYLOAD")

if [ "$RESPONSE" != 204 ]; then
echo "ERROR CALLING MANIFESTS ROLLOUT: HTTP RESPONSE: $RESPONSE"
exit 1
fi

0 comments on commit 4531e5e

Please sign in to comment.