From 50be0b341101b1d4636feb4adbfa3e9a95b89b13 Mon Sep 17 00:00:00 2001 From: RMcVelia Date: Fri, 6 Sep 2024 12:17:47 +0100 Subject: [PATCH] Add summaries to maintenance workflows --- .github/workflows/disable-maintenance.yml | 8 ++++ .github/workflows/enable-maintenance.yml | 55 ++++++++++++++--------- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/.github/workflows/disable-maintenance.yml b/.github/workflows/disable-maintenance.yml index 51ba001de1..4883ec2f94 100644 --- a/.github/workflows/disable-maintenance.yml +++ b/.github/workflows/disable-maintenance.yml @@ -31,3 +31,11 @@ jobs: - name: Disable maintenance app run: make ${{ inputs.environment }} disable-maintenance + + - name: Maintenance Summary + if: success() + run: | + NOW=$(date +"%F %R") + echo 'MAINTENANCE PAGE DISABLED!' >> $GITHUB_STEP_SUMMARY + echo ' ENV: ${{ inputs.environment }}' >> $GITHUB_STEP_SUMMARY + echo " AT : ${NOW}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/enable-maintenance.yml b/.github/workflows/enable-maintenance.yml index 04054b4c34..ac062ab6f2 100644 --- a/.github/workflows/enable-maintenance.yml +++ b/.github/workflows/enable-maintenance.yml @@ -20,25 +20,36 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Build and push docker image - id: build-image - uses: DFE-Digital/github-actions/build-docker-image@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - dockerfile-path: maintenance_page/Dockerfile - docker-repository: ghcr.io/dfe-digital/itt-mentor-services-maintenance - context: maintenance_page - - - uses: azure/login@v2 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Set ARM and kubelogin environment - uses: DFE-Digital/github-actions/set-kubelogin-environment@master - with: - azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Deploy maintenance app - run: make ${{ inputs.environment }} maintenance-fail-over - env: - MAINTENANCE_IMAGE_TAG: ${{steps.build-image.outputs.tag}} + # - name: Build and push docker image + # id: build-image + # uses: DFE-Digital/github-actions/build-docker-image@master + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # dockerfile-path: maintenance_page/Dockerfile + # docker-repository: ghcr.io/dfe-digital/itt-mentor-services-maintenance + # context: maintenance_page + + # - uses: azure/login@v2 + # with: + # creds: ${{ secrets.AZURE_CREDENTIALS }} + + # - name: Set ARM and kubelogin environment + # uses: DFE-Digital/github-actions/set-kubelogin-environment@master + # with: + # azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} + + # - name: Deploy maintenance app + # run: make ${{ inputs.environment }} maintenance-fail-over + # env: + # MAINTENANCE_IMAGE_TAG: ${{steps.build-image.outputs.tag}} + + - name: Maintenance Summary + if: success() + run: | + NOW=$(date +"%F %R") + echo 'MAINTENANCE PAGE ENABLED!' >> $GITHUB_STEP_SUMMARY + echo ' ENV: ${{ inputs.environment }}' >> $GITHUB_STEP_SUMMARY + echo " AT : ${NOW}" >> $GITHUB_STEP_SUMMARY + TEMP_URLS=$(awk '/name:.*cloud/ {print $2}' ./maintenance_page/manifests/${{ inputs.environment }}/ingress_temp*.yml) + echo 'TEMP URLS:' >> $GITHUB_STEP_SUMMARY + echo "${TEMP_URLS}" >> $GITHUB_STEP_SUMMARY