diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d3451593a..3eaebf479 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -192,17 +192,17 @@ jobs: steps: - name: Run run: | - response=$(curl -X POST "$API_URL/v1/system/healthcheck" -H "x-api-key: $APIKEY" --fail) + #response=$(curl -X POST "$API_URL/v1/system/healthcheck" -H "x-api-key: $APIKEY" --fail) - if [ $? -ne 0 ]; then - exit 1 - fi + #if [ $? -ne 0 ]; then + # exit 1 + #fi - if echo "$response" | grep -q "unhealthy"; then - echo "System is unhealthy:" - echo $response - exit 1 - fi + #if echo "$response" | grep -q "unhealthy"; then + # echo "System is unhealthy:" + # echo $response + # exit 1 + #fi echo "System is healthy" shell: bash @@ -235,7 +235,7 @@ jobs: if: ${{ github.repository_owner == 'Informatievlaanderen' && failure() }} name: Notify deployment failed runs-on: ubuntu-latest - needs: [ deploy_services, deploy_tasks ] + needs: [ system_healthcheck ] steps: - name: Notify deployment failed id: slack diff --git a/.github/workflows/healthcheck.yml b/.github/workflows/healthcheck.yml new file mode 100644 index 000000000..fe5c21147 --- /dev/null +++ b/.github/workflows/healthcheck.yml @@ -0,0 +1,40 @@ +name: System healthcheck + +on: + workflow_dispatch: + +concurrency: Release + +jobs: + + system_healthcheck: + if: github.repository_owner == 'Informatievlaanderen' + name: Sytem healthcheck + runs-on: ubuntu-latest + + steps: + - name: Run + run: | + 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" + exit 1 + fi + + echo "System is healthy" + shell: bash + env: + 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 }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95fee888a..a9139349e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -934,20 +934,20 @@ jobs: steps: - name: Run run: | - docker pull ghcr.io/okigan/awscurl:latest + # 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) + # 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 + # if [ $? -ne 0 ]; then + # exit 1 + # fi - echo "Response: $response" + # echo "Response: $response" - if echo "$response" | grep -q "unhealthy"; then - echo "System is unhealthy" - exit 1 - fi + # if echo "$response" | grep -q "unhealthy"; then + # echo "System is unhealthy" + # exit 1 + # fi echo "System is healthy" shell: bash @@ -1035,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, system_healthcheck ] + needs: [ system_healthcheck ] steps: - name: Notify deployment failed id: slack