Skip to content

Commit

Permalink
fix: system healthcheck via pipeline (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikdepeuter authored Sep 20, 2024
1 parent 5a56286 commit 4046c35
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ jobs:

build-lambda-backoffice:
name: Build Lambda BackOffice
uses: Informatievlaanderen/build-pipeline/.github/workflows/build-lambda.yml@version-lambda
uses: Informatievlaanderen/build-pipeline/.github/workflows/build-lambda.yml@main
needs: [ set-release-version ]
if: ${{ (github.repository_owner == 'Informatievlaanderen') && (needs.set-release-version.outputs.version != 'none') }}
with:
Expand All @@ -385,7 +385,7 @@ jobs:

build-lambda-snapshot:
name: Build Lambda Snapshot
uses: Informatievlaanderen/build-pipeline/.github/workflows/build-lambda.yml@version-lambda
uses: Informatievlaanderen/build-pipeline/.github/workflows/build-lambda.yml@main
needs: [ set-release-version ]
if: ${{ (github.repository_owner == 'Informatievlaanderen') && (needs.set-release-version.outputs.version != 'none') }}
with:
Expand Down Expand Up @@ -927,30 +927,36 @@ jobs:

system_healthcheck:
if: github.repository_owner == 'Informatievlaanderen'
needs: [ release, deploy_lambda_to_test ]
needs: [ deploy_lambda_to_test ]
name: Sytem healthcheck
runs-on: ubuntu-latest

steps:
- name: Run
run: |
response=$(curl -X POST "$API_URL/v1/system/healthcheck" -H "x-api-key: $APIKEY" --fail)
docker pull ghcr.io/okigan/awscurl:latest
response=$(docker run --rm okigan/awscurl --access_key $ACCESS_KEY_ID --secret_key $SECRET_ACCESS_KEY_ID --region $REGION -X POST $BACKOFFICE_API_URL/v1/system/healthcheck -H "x-api-key: $ROAD_API_KEY" --fail)
if [ $? -ne 0 ]; then
exit 1
fi
echo "Response: $response"
if echo "$response" | grep -q "unhealthy"; then
echo "System is unhealthy:"
echo $response
echo "System is unhealthy"
exit 1
fi
echo "System is healthy"
shell: bash
env:
APIKEY: ${{ secrets.HEALTHCHECK_APIKEY }}
API_URL: ${{ vars.BACKOFFICE_API_URL_TST }}
ACCESS_KEY_ID: ${{ secrets.VBR_AWS_ACCESS_KEY_ID_DEVOPS }}
SECRET_ACCESS_KEY_ID: ${{ secrets.VBR_AWS_SECRET_ACCESS_KEY_DEVOPS }}
REGION: ${{ secrets.VBR_AWS_REGION_PRD }}
ROAD_API_KEY: ${{ secrets.HEALTHCHECK_APIKEY }}
BACKOFFICE_API_URL: ${{ vars.BACKOFFICE_API_URL_TST }}

deploy_to_test_finish_slack:
if: github.repository_owner == 'Informatievlaanderen'
Expand Down Expand Up @@ -1029,7 +1035,7 @@ jobs:
if: ${{ github.repository_owner == 'Informatievlaanderen' && failure() && needs.release.outputs.version && needs.release.outputs.version != 'none' }}
name: Notify deployment failed
runs-on: ubuntu-latest
needs: [ deploy_services_to_test, deploy_tasks_to_test, release ]
needs: [ deploy_services_to_test, deploy_tasks_to_test, system_healthcheck ]
steps:
- name: Notify deployment failed
id: slack
Expand Down

0 comments on commit 4046c35

Please sign in to comment.