From 9d3c522b397f83abf8c809b348be4c8c85d92c1a Mon Sep 17 00:00:00 2001 From: Megan Date: Tue, 11 Nov 2025 15:24:55 +0000 Subject: [PATCH 01/16] [NDR-313] Testing slack notification --- .github/workflows/ndr-e2e-test-sandbox.yml | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index d925ddf21..eb3d23a52 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -35,3 +35,36 @@ jobs: sandbox: ${{ inputs.sandbox }} secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + + + notify-slack: + runs-on: ubuntu-latest + needs: [services-e2etest, services-fhir-api-e2etest] + if: always() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + role-skip-session-tagging: true + aws-region: ${{ vars.AWS_REGION }} + mask-aws-account-id: true + + - name: Get SSM parameters from SSM + id: ssm-parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + + - name: Send Slack Notification + uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # Version v2.1.1 + env: + SLACK_BOT_TOKEN: ${{ env.SLACK_BOT_TOKEN }} + with: + method: chat.postMessage + token: $SLACK_BOT_TOKEN + payload: | + channel: ${{ vars.ALERTS_SLACK_CHANNEL_ID }} + text: "Workflow has run" + From 553a072ad5ef72779a6b380498c866fdda6eb858 Mon Sep 17 00:00:00 2001 From: Megan Date: Tue, 11 Nov 2025 15:30:40 +0000 Subject: [PATCH 02/16] [NDR-313] Revert version --- .github/workflows/ndr-e2e-test-sandbox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index eb3d23a52..01495e4b2 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -43,7 +43,7 @@ jobs: if: always() steps: - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v5 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} role-skip-session-tagging: true From ee73d1529232caa326586eaa39c309db3795023c Mon Sep 17 00:00:00 2001 From: Megan Date: Tue, 11 Nov 2025 16:07:19 +0000 Subject: [PATCH 03/16] [NDR-313] Add workflow_call block to pass secret --- .github/workflows/ndr-e2e-test-sandbox.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 01495e4b2..2d1ef2b3c 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -12,6 +12,19 @@ on: description: "Sandbox environment" required: true default: "ndr" + workflow_call: + inputs: + build_branch: + description: "Branch with smoke tests." + required: true + type: "string" + sandbox: + description: "Sandbox to push code to" + required: true + type: string + secrets: + AWS_ASSUME_ROLE: + required: true permissions: pull-requests: write @@ -43,7 +56,7 @@ jobs: if: always() steps: - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 + uses: aws-actions/configure-aws-credentials@v5 with: role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} role-skip-session-tagging: true From b72741a4029ae3edd20747c020be6d1d38936520 Mon Sep 17 00:00:00 2001 From: Megan Date: Thu, 13 Nov 2025 09:03:06 +0000 Subject: [PATCH 04/16] [NDR-313] Add environment settings to workflow --- .github/workflows/ndr-e2e-test-sandbox.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 2d1ef2b3c..7efe38088 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -12,25 +12,21 @@ on: description: "Sandbox environment" required: true default: "ndr" - workflow_call: - inputs: - build_branch: - description: "Branch with smoke tests." - required: true - type: "string" - sandbox: - description: "Sandbox to push code to" + environment: + description: Which environment settings to use? required: true type: string - secrets: - AWS_ASSUME_ROLE: - required: true + default: development permissions: pull-requests: write id-token: write contents: read +env: + SANDBOX: ${{ inputs.sandbox }} + AWS_REGION: ${{ vars.AWS_REGION }} + jobs: services-e2etest: uses: ./.github/workflows/base-e2e-backendtest.yml @@ -40,6 +36,7 @@ jobs: sandbox: ${{ inputs.sandbox }} secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + services-fhir-api-e2etest: uses: ./.github/workflows/base-e2e-fhir-backendtest.yml with: @@ -49,9 +46,9 @@ jobs: secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} - notify-slack: runs-on: ubuntu-latest + environment: ${{ inputs.environment }} needs: [services-e2etest, services-fhir-api-e2etest] if: always() steps: From 06970f240e91309643606f56f41b646f3d6feb80 Mon Sep 17 00:00:00 2001 From: Megan Date: Thu, 13 Nov 2025 10:57:09 +0000 Subject: [PATCH 05/16] [NDR-313] Update env reference --- .github/workflows/ndr-e2e-test-sandbox.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 7efe38088..32f999cd7 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -69,11 +69,9 @@ jobs: - name: Send Slack Notification uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # Version v2.1.1 - env: - SLACK_BOT_TOKEN: ${{ env.SLACK_BOT_TOKEN }} with: method: chat.postMessage - token: $SLACK_BOT_TOKEN + token: ${{ env.SLACK_BOT_TOKEN }} payload: | channel: ${{ vars.ALERTS_SLACK_CHANNEL_ID }} text: "Workflow has run" From cfd8de1afb4e4f5f64355d42591de6e3ac8fe3cc Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 09:24:54 +0000 Subject: [PATCH 06/16] [NDR-313] Update slack message --- .github/workflows/ndr-e2e-test-sandbox.yml | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 32f999cd7..ebc938de6 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -68,11 +68,37 @@ jobs: echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV - name: Send Slack Notification - uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # Version v2.1.1 + uses: slackapi/slack-github-action@v2.1.1 with: method: chat.postMessage token: ${{ env.SLACK_BOT_TOKEN }} payload: | channel: ${{ vars.ALERTS_SLACK_CHANNEL_ID }} - text: "Workflow has run" + attachments: + - color: ${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }} + blocks: + - type: header + text: + type: plain_text + text: ${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }} + - type: section + text: + type: mrkdwn + text: > + *Triggered by:* `${{ github.actor }}` + \n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details> + - type: divider + - type: section + fields: + - type: mrkdwn + text: "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + - type: mrkdwn + text: "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + - type: context + elements: + - type: mrkdwn + + + + From 6f266469c177d9812c9245b7f14fa8ef43ee8b7e Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 09:39:18 +0000 Subject: [PATCH 07/16] [NDR-313] Use json in slack message --- .github/workflows/ndr-e2e-test-sandbox.yml | 74 ++++++++++++++-------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index ebc938de6..eae77d8cb 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -73,31 +73,55 @@ jobs: method: chat.postMessage token: ${{ env.SLACK_BOT_TOKEN }} payload: | - channel: ${{ vars.ALERTS_SLACK_CHANNEL_ID }} - attachments: - - color: ${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }} - blocks: - - type: header - text: - type: plain_text - text: ${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }} - - type: section - text: - type: mrkdwn - text: > - *Triggered by:* `${{ github.actor }}` - \n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details> - - type: divider - - type: section - fields: - - type: mrkdwn - text: "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - - type: mrkdwn - text: "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - - type: context - elements: - - type: mrkdwn - + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }}", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }}" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `${{ inputs.environment }}` | Sandbox: `${{ inputs.sandbox }}`" + } + ] + } + ] + } + ] + } From fcfc477b9460079770db0e3886c89851e94a45a5 Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 10:03:11 +0000 Subject: [PATCH 08/16] [NDR-313] Temporary test failure to test slack notification --- lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py index 5cafe6b7d..b2b826789 100644 --- a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py +++ b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py @@ -35,6 +35,7 @@ def test_file_retrieval(test_data, file_size): f"{pdm_record['nhs_number']}/{pdm_record['id']}" ) assert expected_presign_uri in json["content"][0]["attachment"]["url"] + assert False # Temporary fail to test slack messaging - REMOVE ME @pytest.mark.parametrize( From cdb81fb928e5849c47818734421997f5d7e29b66 Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 11:04:05 +0000 Subject: [PATCH 09/16] [NDR-313] Move slack notifiacation to merge to main workflows only --- .../workflows/base-e2e-fhir-backendtest.yml | 3 + .github/workflows/lambdas-dev-to-main-ci.yml | 88 +++++++++++++++++++ .github/workflows/ndr-e2e-backend-test-ci.yml | 77 ++++++++++++++++ .github/workflows/ndr-e2e-test-sandbox.yml | 85 +----------------- .../fhir/test_retrieve_document_fhir_api.py | 1 - 5 files changed, 170 insertions(+), 84 deletions(-) diff --git a/.github/workflows/base-e2e-fhir-backendtest.yml b/.github/workflows/base-e2e-fhir-backendtest.yml index 93a02ea3a..ec3448152 100644 --- a/.github/workflows/base-e2e-fhir-backendtest.yml +++ b/.github/workflows/base-e2e-fhir-backendtest.yml @@ -29,6 +29,9 @@ jobs: e2e-test: runs-on: ubuntu-latest environment: ${{ inputs.environment }} + outputs: + environment: ${{ inputs.environment }} + sandbox: ${{ inputs.sandbox }} steps: - name: Checkout uses: actions/checkout@v5 diff --git a/.github/workflows/lambdas-dev-to-main-ci.yml b/.github/workflows/lambdas-dev-to-main-ci.yml index c5f32aacb..f31a6add2 100644 --- a/.github/workflows/lambdas-dev-to-main-ci.yml +++ b/.github/workflows/lambdas-dev-to-main-ci.yml @@ -78,3 +78,91 @@ jobs: sandbox: ndr-dev secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + + notify-slack: + runs-on: ubuntu-latest + needs: [check_packages, run_tests, publish_all_lambda_layers, deploy_all_lambdas, deploy_data_collection] + if: failure() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + role-skip-session-tagging: true + aws-region: ${{ vars.AWS_REGION }} + mask-aws-account-id: true + + - name: Get SSM parameters from SSM + id: ssm-parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + + - name: Send Slack Notification + uses: slackapi/slack-github-action@v2.1.1 + with: + method: chat.postMessage + token: ${{ env.SLACK_BOT_TOKEN }} + payload: | + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "#ff0000", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "❌ Workflow `${{ github.workflow }}` failed" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*check_packages:* ${{ needs.check_packages.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*run_tests:* ${{ needs.run_tests.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*publish_all_lambda_layers:* ${{ needs.publish_all_lambda_layers.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*deploy_all_lambdas:* ${{ needs.deploy_all_lambdas.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*deploy_data_collection:* ${{ needs.deploy_data_collection.result == 'success' && ':white_check_mark:' || ':x:' }}" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `development` | Sandbox: `ndr-dev`" + } + ] + } + ] + } + ] + } diff --git a/.github/workflows/ndr-e2e-backend-test-ci.yml b/.github/workflows/ndr-e2e-backend-test-ci.yml index 4005942ab..d0396fda8 100644 --- a/.github/workflows/ndr-e2e-backend-test-ci.yml +++ b/.github/workflows/ndr-e2e-backend-test-ci.yml @@ -24,6 +24,7 @@ jobs: sandbox: ndr-dev secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + services-fhir-api-e2etest: uses: ./.github/workflows/base-e2e-fhir-backendtest.yml with: @@ -32,3 +33,79 @@ jobs: sandbox: ndr-dev secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + + notify-slack: + runs-on: ubuntu-latest + needs: [services-e2etest, services-fhir-api-e2etest] + if: failure() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + role-skip-session-tagging: true + aws-region: ${{ vars.AWS_REGION }} + mask-aws-account-id: true + + - name: Get SSM parameters from SSM + id: ssm-parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + + - name: Send Slack Notification + uses: slackapi/slack-github-action@v2.1.1 + with: + method: chat.postMessage + token: ${{ env.SLACK_BOT_TOKEN }} + payload: | + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "#ff0000", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "❌ Workflow `${{ github.workflow }}` failed" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `${{ needs.services-fhir-api-e2etest.outputs.environment }}` | Sandbox: `${{ needs.services-fhir-api-e2etest.outputs.sandbox }}`" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index eae77d8cb..3c2005c0a 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -23,16 +23,12 @@ permissions: id-token: write contents: read -env: - SANDBOX: ${{ inputs.sandbox }} - AWS_REGION: ${{ vars.AWS_REGION }} - jobs: services-e2etest: uses: ./.github/workflows/base-e2e-backendtest.yml with: build_branch: ${{ inputs.build_branch }} - environment: development + environment: ${{ inputs.environment }} sandbox: ${{ inputs.sandbox }} secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} @@ -41,87 +37,10 @@ jobs: uses: ./.github/workflows/base-e2e-fhir-backendtest.yml with: build_branch: ${{ inputs.build_branch }} - environment: development + environment: ${{ inputs.environment }} sandbox: ${{ inputs.sandbox }} secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} - - notify-slack: - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - needs: [services-e2etest, services-fhir-api-e2etest] - if: always() - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v5 - with: - role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} - role-skip-session-tagging: true - aws-region: ${{ vars.AWS_REGION }} - mask-aws-account-id: true - - - name: Get SSM parameters from SSM - id: ssm-parameters - run: | - slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) - echo "::add-mask::$slack_bot_token" - echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV - - - name: Send Slack Notification - uses: slackapi/slack-github-action@v2.1.1 - with: - method: chat.postMessage - token: ${{ env.SLACK_BOT_TOKEN }} - payload: | - { - "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", - "attachments": [ - { - "color": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }}", - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" - } - }, - { - "type": "divider" - }, - { - "type": "section", - "fields": [ - { - "type": "mrkdwn", - "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - }, - { - "type": "mrkdwn", - "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - } - ] - }, - { - "type": "context", - "elements": [ - { - "type": "mrkdwn", - "text": "Environment: `${{ inputs.environment }}` | Sandbox: `${{ inputs.sandbox }}`" - } - ] - } - ] - } - ] - } diff --git a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py index b2b826789..5cafe6b7d 100644 --- a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py +++ b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py @@ -35,7 +35,6 @@ def test_file_retrieval(test_data, file_size): f"{pdm_record['nhs_number']}/{pdm_record['id']}" ) assert expected_presign_uri in json["content"][0]["attachment"]["url"] - assert False # Temporary fail to test slack messaging - REMOVE ME @pytest.mark.parametrize( From 767237084872314f6f07947601efd840e2356cec Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 11:12:25 +0000 Subject: [PATCH 10/16] [NDR-313] Add slack notifiacation to other merge to main workflows --- .../workflows/ndr-smoketest-ui-test-ci.yml | 69 +++++++++++++++++ .github/workflows/ui-dev-to-main-ci.yml | 77 ++++++++++++++++++- 2 files changed, 142 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ndr-smoketest-ui-test-ci.yml b/.github/workflows/ndr-smoketest-ui-test-ci.yml index d1e8a2cdc..e0fb2faca 100644 --- a/.github/workflows/ndr-smoketest-ui-test-ci.yml +++ b/.github/workflows/ndr-smoketest-ui-test-ci.yml @@ -29,3 +29,72 @@ jobs: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} CYPRESS_ODSCODE: ${{ secrets.CYPRESS_ODSCODE }} CYPRESS_KEY: ${{ secrets.CYPRESS_KEY }} + + notify-slack: + runs-on: ubuntu-latest + needs: [smoketest] + if: failure() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Get SSM parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + + - name: Send Slack Notification + uses: slackapi/slack-github-action@v2.1.1 + with: + method: chat.postMessage + token: ${{ env.SLACK_BOT_TOKEN }} + payload: | + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "#ff0000", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "❌ Workflow `${{ github.workflow }}` failed" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*smoketest:* ${{ needs.smoketest.result == 'success' && ':white_check_mark:' || ':x:' }}" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `development` | Sandbox: `ndr-dev`" + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/.github/workflows/ui-dev-to-main-ci.yml b/.github/workflows/ui-dev-to-main-ci.yml index 9140f04c3..e78cfd0fe 100644 --- a/.github/workflows/ui-dev-to-main-ci.yml +++ b/.github/workflows/ui-dev-to-main-ci.yml @@ -32,13 +32,13 @@ jobs: name: Run UI Unit Tests uses: ./.github/workflows/base-vitest-test.yml with: - build_branch: ${{github.event.pull_request.head.ref}} + build_branch: ${{ github.event.pull_request.head.ref }} cypress_build_job: name: Build UI version for E2E Tests uses: ./.github/workflows/base-cypress-build.yml with: - build_branch: ${{github.event.pull_request.head.ref}} + build_branch: ${{ github.event.pull_request.head.ref }} cypress_test_job: name: Run Cypress E2E Tests @@ -46,7 +46,7 @@ jobs: uses: ./.github/workflows/base-cypress-test-all-env.yml with: cypress_base_url: ${{ vars.CYPRESS_BASE_URL }} - build_branch: ${{github.event.pull_request.head.ref}} + build_branch: ${{ github.event.pull_request.head.ref }} deploy_ui: name: Deploy UI @@ -54,8 +54,77 @@ jobs: needs: ["react_testing_job", "cypress_test_job"] uses: ./.github/workflows/base-deploy-ui.yml with: - build_branch: ${{github.event.pull_request.head.ref}} + build_branch: ${{ github.event.pull_request.head.ref }} environment: development sandbox: ndr-dev secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + + notify-slack: + runs-on: ubuntu-latest + needs: [react_testing_job, cypress_build_job, cypress_test_job, deploy_ui] + if: failure() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Get SSM parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + + - name: Send Slack Notification + uses: slackapi/slack-github-action@v2.1.1 + with: + method: chat.postMessage + token: ${{ env.SLACK_BOT_TOKEN }} + payload: | + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "#ff0000", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "❌ Workflow `${{ github.workflow }}` failed" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*react_testing_job:* ${{ needs.react_testing_job.result == 'success' && ':white_check_mark:' || ':x:' }}" }, + { "type": "mrkdwn", "text": "*cypress_build_job:* ${{ needs.cypress_build_job.result == 'success' && ':white_check_mark:' || ':x:' }}" }, + { "type": "mrkdwn", "text": "*cypress_test_job:* ${{ needs.cypress_test_job.result == 'success' && ':white_check_mark:' || ':x:' }}" }, + { "type": "mrkdwn", "text": "*deploy_ui:* ${{ needs.deploy_ui.result == 'success' && ':white_check_mark:' || ':x:' }}" } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `development` | Sandbox: `ndr-dev`" + } + ] + } + ] + } + ] + } \ No newline at end of file From 751b663b69792d8146f90b91bc0bb09aae6c9f77 Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 11:16:08 +0000 Subject: [PATCH 11/16] [NDR-313] Test branch name in message --- .github/workflows/ndr-e2e-test-sandbox.yml | 76 ++++++++++++++++++- .../e2e/api/test_retrieve_document_api.py | 2 + 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 3c2005c0a..1f6bd86e0 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -42,6 +42,80 @@ jobs: secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} - + notify-slack: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + needs: [services-e2etest, services-fhir-api-e2etest] + if: always() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + role-skip-session-tagging: true + aws-region: ${{ vars.AWS_REGION }} + mask-aws-account-id: true + + - name: Get SSM parameters from SSM + id: ssm-parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + - name: Send Slack Notification + uses: slackapi/slack-github-action@v2.1.1 + with: + method: chat.postMessage + token: ${{ env.SLACK_BOT_TOKEN }} + payload: | + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }}", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }}" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Branch:* `${{ github.event.pull_request.head.ref || github.ref_name }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `${{ inputs.environment }}` | Sandbox: `${{ inputs.sandbox }}`" + } + ] + } + ] + } + ] + } diff --git a/lambdas/tests/e2e/api/test_retrieve_document_api.py b/lambdas/tests/e2e/api/test_retrieve_document_api.py index 4f464c7b5..c96da7cb8 100644 --- a/lambdas/tests/e2e/api/test_retrieve_document_api.py +++ b/lambdas/tests/e2e/api/test_retrieve_document_api.py @@ -36,6 +36,8 @@ def test_small_file(test_data, snapshot_json): assert json == snapshot_json(exclude=paths("date", "id")) + assert False + def test_large_file(test_data, snapshot_json): lloyd_george_record = {} From e90dffbee6f23f9e38237285dd075223b2d43e22 Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 11:24:46 +0000 Subject: [PATCH 12/16] [NDR-313] Remove False assertion --- .github/workflows/ndr-e2e-test-sandbox.yml | 77 ------------------- .../e2e/api/test_retrieve_document_api.py | 2 - 2 files changed, 79 deletions(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 1f6bd86e0..6dcd1f0bc 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -41,81 +41,4 @@ jobs: sandbox: ${{ inputs.sandbox }} secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} - - notify-slack: - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - needs: [services-e2etest, services-fhir-api-e2etest] - if: always() - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v5 - with: - role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} - role-skip-session-tagging: true - aws-region: ${{ vars.AWS_REGION }} - mask-aws-account-id: true - - - name: Get SSM parameters from SSM - id: ssm-parameters - run: | - slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) - echo "::add-mask::$slack_bot_token" - echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV - - name: Send Slack Notification - uses: slackapi/slack-github-action@v2.1.1 - with: - method: chat.postMessage - token: ${{ env.SLACK_BOT_TOKEN }} - payload: | - { - "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", - "attachments": [ - { - "color": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }}", - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Branch:* `${{ github.event.pull_request.head.ref || github.ref_name }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" - } - }, - { - "type": "divider" - }, - { - "type": "section", - "fields": [ - { - "type": "mrkdwn", - "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - }, - { - "type": "mrkdwn", - "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - } - ] - }, - { - "type": "context", - "elements": [ - { - "type": "mrkdwn", - "text": "Environment: `${{ inputs.environment }}` | Sandbox: `${{ inputs.sandbox }}`" - } - ] - } - ] - } - ] - } - diff --git a/lambdas/tests/e2e/api/test_retrieve_document_api.py b/lambdas/tests/e2e/api/test_retrieve_document_api.py index c96da7cb8..4f464c7b5 100644 --- a/lambdas/tests/e2e/api/test_retrieve_document_api.py +++ b/lambdas/tests/e2e/api/test_retrieve_document_api.py @@ -36,8 +36,6 @@ def test_small_file(test_data, snapshot_json): assert json == snapshot_json(exclude=paths("date", "id")) - assert False - def test_large_file(test_data, snapshot_json): lloyd_george_record = {} From fa7116b48e2730b150412231bd1f150820ad7945 Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 12:19:08 +0000 Subject: [PATCH 13/16] [NDR-313] Only alert on merge to main failures not pull requests --- .github/workflows/lambdas-dev-to-main-ci.yml | 2 +- .github/workflows/ui-dev-to-main-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lambdas-dev-to-main-ci.yml b/.github/workflows/lambdas-dev-to-main-ci.yml index f31a6add2..15e41a25e 100644 --- a/.github/workflows/lambdas-dev-to-main-ci.yml +++ b/.github/workflows/lambdas-dev-to-main-ci.yml @@ -82,7 +82,7 @@ jobs: notify-slack: runs-on: ubuntu-latest needs: [check_packages, run_tests, publish_all_lambda_layers, deploy_all_lambdas, deploy_data_collection] - if: failure() + if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v5 diff --git a/.github/workflows/ui-dev-to-main-ci.yml b/.github/workflows/ui-dev-to-main-ci.yml index e78cfd0fe..abdf818d7 100644 --- a/.github/workflows/ui-dev-to-main-ci.yml +++ b/.github/workflows/ui-dev-to-main-ci.yml @@ -63,7 +63,7 @@ jobs: notify-slack: runs-on: ubuntu-latest needs: [react_testing_job, cypress_build_job, cypress_test_job, deploy_ui] - if: failure() + if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v5 From 8990998a9bd45444ab5d60a67020a41c984b1c4c Mon Sep 17 00:00:00 2001 From: Megan Date: Fri, 14 Nov 2025 12:38:52 +0000 Subject: [PATCH 14/16] [NDR-313] Update link with actual workflow name --- .github/workflows/lambdas-dev-to-main-ci.yml | 2 +- .github/workflows/ndr-e2e-backend-test-ci.yml | 2 +- .github/workflows/ndr-e2e-test-sandbox.yml | 75 +++++++++++++++++++ .../workflows/ndr-smoketest-ui-test-ci.yml | 2 +- .github/workflows/ui-dev-to-main-ci.yml | 2 +- .../fhir/test_retrieve_document_fhir_api.py | 2 + 6 files changed, 81 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lambdas-dev-to-main-ci.yml b/.github/workflows/lambdas-dev-to-main-ci.yml index 15e41a25e..788eb13e5 100644 --- a/.github/workflows/lambdas-dev-to-main-ci.yml +++ b/.github/workflows/lambdas-dev-to-main-ci.yml @@ -122,7 +122,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>" } }, { diff --git a/.github/workflows/ndr-e2e-backend-test-ci.yml b/.github/workflows/ndr-e2e-backend-test-ci.yml index d0396fda8..1f723a054 100644 --- a/.github/workflows/ndr-e2e-backend-test-ci.yml +++ b/.github/workflows/ndr-e2e-backend-test-ci.yml @@ -77,7 +77,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>" } }, { diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 6dcd1f0bc..732e2abba 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -42,3 +42,78 @@ jobs: secrets: AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} + notify-slack: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + needs: [services-e2etest, services-fhir-api-e2etest] + if: always() + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} + role-skip-session-tagging: true + aws-region: ${{ vars.AWS_REGION }} + mask-aws-account-id: true + + - name: Get SSM parameters from SSM + id: ssm-parameters + run: | + slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) + echo "::add-mask::$slack_bot_token" + echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV + - name: Send Slack Notification + uses: slackapi/slack-github-action@v2.1.1 + with: + method: chat.postMessage + token: ${{ env.SLACK_BOT_TOKEN }} + payload: | + { + "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", + "attachments": [ + { + "color": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }}", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }}" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Triggered by:* `${{ github.actor }}`\n*Branch:* `${{ github.event.pull_request.head.ref || github.ref_name }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>" + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + }, + { + "type": "mrkdwn", + "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" + } + ] + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Environment: `${{ inputs.environment }}` | Sandbox: `${{ inputs.sandbox }}`" + } + ] + } + ] + } + ] + } diff --git a/.github/workflows/ndr-smoketest-ui-test-ci.yml b/.github/workflows/ndr-smoketest-ui-test-ci.yml index e0fb2faca..ac256d416 100644 --- a/.github/workflows/ndr-smoketest-ui-test-ci.yml +++ b/.github/workflows/ndr-smoketest-ui-test-ci.yml @@ -70,7 +70,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>" } }, { diff --git a/.github/workflows/ui-dev-to-main-ci.yml b/.github/workflows/ui-dev-to-main-ci.yml index abdf818d7..2cc15ace4 100644 --- a/.github/workflows/ui-dev-to-main-ci.yml +++ b/.github/workflows/ui-dev-to-main-ci.yml @@ -100,7 +100,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + "text": "*Triggered by:* `${{ github.actor }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>" } }, { diff --git a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py index 5cafe6b7d..7aa24b64c 100644 --- a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py +++ b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py @@ -36,6 +36,8 @@ def test_file_retrieval(test_data, file_size): ) assert expected_presign_uri in json["content"][0]["attachment"]["url"] + assert False + @pytest.mark.parametrize( "record_id,expected_status,expected_code,expected_diagnostics", From 52c685b9feb401c03b1e5f796abce9d5fe4aec78 Mon Sep 17 00:00:00 2001 From: Megan Date: Mon, 17 Nov 2025 09:13:42 +0000 Subject: [PATCH 15/16] [NDR-313] Remove false assertion --- .github/workflows/ndr-e2e-test-sandbox.yml | 78 +------------------ .../fhir/test_retrieve_document_fhir_api.py | 2 - 2 files changed, 1 insertion(+), 79 deletions(-) diff --git a/.github/workflows/ndr-e2e-test-sandbox.yml b/.github/workflows/ndr-e2e-test-sandbox.yml index 732e2abba..65e66df54 100644 --- a/.github/workflows/ndr-e2e-test-sandbox.yml +++ b/.github/workflows/ndr-e2e-test-sandbox.yml @@ -40,80 +40,4 @@ jobs: environment: ${{ inputs.environment }} sandbox: ${{ inputs.sandbox }} secrets: - AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} - - notify-slack: - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - needs: [services-e2etest, services-fhir-api-e2etest] - if: always() - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v5 - with: - role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} - role-skip-session-tagging: true - aws-region: ${{ vars.AWS_REGION }} - mask-aws-account-id: true - - - name: Get SSM parameters from SSM - id: ssm-parameters - run: | - slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) - echo "::add-mask::$slack_bot_token" - echo "SLACK_BOT_TOKEN=$slack_bot_token" >> $GITHUB_ENV - - name: Send Slack Notification - uses: slackapi/slack-github-action@v2.1.1 - with: - method: chat.postMessage - token: ${{ env.SLACK_BOT_TOKEN }} - payload: | - { - "channel": "${{ vars.ALERTS_SLACK_CHANNEL_ID }}", - "attachments": [ - { - "color": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '#36a64f' || '#ff0000' }}", - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "${{ (needs.services-e2etest.result == 'success' && needs.services-fhir-api-e2etest.result == 'success') && '✅ Workflow SANDBOX: E2e Tests Backend succeeded' || '❌ Workflow SANDBOX: E2e Tests Backend failed' }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Triggered by:* `${{ github.actor }}`\n*Branch:* `${{ github.event.pull_request.head.ref || github.ref_name }}`\n*Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>" - } - }, - { - "type": "divider" - }, - { - "type": "section", - "fields": [ - { - "type": "mrkdwn", - "text": "*services-e2etest:* ${{ needs.services-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - }, - { - "type": "mrkdwn", - "text": "*services-fhir-api-e2etest:* ${{ needs.services-fhir-api-e2etest.result == 'success' && ':white_check_mark:' || ':x:' }}" - } - ] - }, - { - "type": "context", - "elements": [ - { - "type": "mrkdwn", - "text": "Environment: `${{ inputs.environment }}` | Sandbox: `${{ inputs.sandbox }}`" - } - ] - } - ] - } - ] - } + AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }} \ No newline at end of file diff --git a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py index 7aa24b64c..5cafe6b7d 100644 --- a/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py +++ b/lambdas/tests/e2e/api/fhir/test_retrieve_document_fhir_api.py @@ -36,8 +36,6 @@ def test_file_retrieval(test_data, file_size): ) assert expected_presign_uri in json["content"][0]["attachment"]["url"] - assert False - @pytest.mark.parametrize( "record_id,expected_status,expected_code,expected_diagnostics", From 2eecc2759f305035c17ef75e0691f9e2cc5722b0 Mon Sep 17 00:00:00 2001 From: Megan Date: Wed, 19 Nov 2025 13:10:24 +0000 Subject: [PATCH 16/16] [NDR-313] Update step name --- .github/workflows/base-deploy-ui.yml | 2 +- .github/workflows/lambdas-dev-to-main-ci.yml | 2 +- .github/workflows/ndr-e2e-backend-test-ci.yml | 2 +- .github/workflows/ndr-smoketest-ui-test-ci.yml | 2 +- .github/workflows/ui-dev-to-main-ci.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/base-deploy-ui.yml b/.github/workflows/base-deploy-ui.yml index 2acef787d..0816d3605 100644 --- a/.github/workflows/base-deploy-ui.yml +++ b/.github/workflows/base-deploy-ui.yml @@ -49,7 +49,7 @@ jobs: aws-region: ${{ vars.AWS_REGION }} mask-aws-account-id: true - - name: Get SSM parameters from SSM + - name: Get SSM parameters id: ssm-parameters run: | doc_store_api_endpoint=$(aws ssm get-parameter --name "/ndr/${{ inputs.sandbox }}/api_endpoint" --with-decryption --query "Parameter.Value" --output text) diff --git a/.github/workflows/lambdas-dev-to-main-ci.yml b/.github/workflows/lambdas-dev-to-main-ci.yml index 788eb13e5..ace1b5081 100644 --- a/.github/workflows/lambdas-dev-to-main-ci.yml +++ b/.github/workflows/lambdas-dev-to-main-ci.yml @@ -92,7 +92,7 @@ jobs: aws-region: ${{ vars.AWS_REGION }} mask-aws-account-id: true - - name: Get SSM parameters from SSM + - name: Get slack bot token from SSM parameter store id: ssm-parameters run: | slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) diff --git a/.github/workflows/ndr-e2e-backend-test-ci.yml b/.github/workflows/ndr-e2e-backend-test-ci.yml index 1f723a054..5267e6dc7 100644 --- a/.github/workflows/ndr-e2e-backend-test-ci.yml +++ b/.github/workflows/ndr-e2e-backend-test-ci.yml @@ -47,7 +47,7 @@ jobs: aws-region: ${{ vars.AWS_REGION }} mask-aws-account-id: true - - name: Get SSM parameters from SSM + - name: Get slack bot token from SSM parameter store id: ssm-parameters run: | slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) diff --git a/.github/workflows/ndr-smoketest-ui-test-ci.yml b/.github/workflows/ndr-smoketest-ui-test-ci.yml index ac256d416..9523c7b24 100644 --- a/.github/workflows/ndr-smoketest-ui-test-ci.yml +++ b/.github/workflows/ndr-smoketest-ui-test-ci.yml @@ -41,7 +41,7 @@ jobs: role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} aws-region: ${{ vars.AWS_REGION }} - - name: Get SSM parameters + - name: Get slack bot token from SSM parameter store run: | slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) echo "::add-mask::$slack_bot_token" diff --git a/.github/workflows/ui-dev-to-main-ci.yml b/.github/workflows/ui-dev-to-main-ci.yml index 2cc15ace4..cead19a6a 100644 --- a/.github/workflows/ui-dev-to-main-ci.yml +++ b/.github/workflows/ui-dev-to-main-ci.yml @@ -71,7 +71,7 @@ jobs: role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} aws-region: ${{ vars.AWS_REGION }} - - name: Get SSM parameters + - name: Get slack bot token from SSM parameter store run: | slack_bot_token=$(aws ssm get-parameter --name "/ndr/alerting/slack/bot_token" --with-decryption --query "Parameter.Value" --output text) echo "::add-mask::$slack_bot_token"