Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/release_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ sam deploy \
NotifyAPIBaseURLValue="$NOTIFY_API_BASE_URL" \
RequireApplicationName="$REQUIRE_APPLICATION_NAME" \
EnableBackup="$ENABLE_BACKUP" \
PsuExecuteLambdaRoleArn="${PSU_EXECUTE_LAMBDA_ROLE_ARN:-none}" \
TestPresciptionsParamValue1="$TEST_PRESCRIPTIONS_1" \
TestPresciptionsParamValue2="$TEST_PRESCRIPTIONS_2" \
TestPresciptionsParamValue3="$TEST_PRESCRIPTIONS_3" \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,5 @@ jobs:
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
PROXYGEN_ROLE: ${{ secrets.PROXYGEN_PTL_ROLE }}
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ jobs:
FORWARD_CSOC_LOGS: false
secrets:
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
PROXYGEN_ROLE: ${{ secrets.PROXYGEN_PTL_ROLE }}
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
release_sandbox_code:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ jobs:
FORWARD_CSOC_LOGS: false
secrets:
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
PROXYGEN_ROLE: ${{ secrets.PROXYGEN_PTL_ROLE }}
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}

Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/run_regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
VERSION_NUMBER:
required: true
type: string
PSU_EXECUTE_LAMBDA_ROLE_ARN:
required: false
type: string
default: ""
REGRESSION_TESTS_PEM:
type: string
pinned_image:
Expand Down Expand Up @@ -57,14 +61,15 @@ jobs:
TARGET_ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }}
GITHUB-TOKEN: ${{ steps.generate-token.outputs.token }}
PSU_EXECUTE_LAMBDA_ROLE_ARN: ${{ inputs.PSU_EXECUTE_LAMBDA_ROLE_ARN }}
run: |
if [[ "$TARGET_ENVIRONMENT" != "prod" && "$TARGET_ENVIRONMENT" != "ref" ]]; then
# this should be the tag of the tests you want to run
REGRESSION_TEST_REPO_TAG=v3.10.9
REGRESSION_TEST_REPO_TAG=aea-6055-gsul-boto-lambda-invoke #v3.10.9

# this should be the tag of the regression test workflow you want to run
# This will normally be the same as REGRESSION_TEST_REPO_TAG
REGRESSION_TEST_WORKFLOW_TAG=v3.10.9
REGRESSION_TEST_WORKFLOW_TAG=aea-6055-gsul-boto-lambda-invoke #v3.10.9

curl https://raw.githubusercontent.com/NHSDigital/electronic-prescription-service-api-regression-tests/refs/tags/${REGRESSION_TEST_WORKFLOW_TAG}/scripts/run_regression_tests.py -o run_regression_tests.py
poetry install
Expand All @@ -76,5 +81,6 @@ jobs:
--is_called_from_github=true \
--product=PSU \
--regression_test_repo_tag "${REGRESSION_TEST_REPO_TAG}" \
--regression_test_workflow_tag "${REGRESSION_TEST_WORKFLOW_TAG}"
--regression_test_workflow_tag "${REGRESSION_TEST_WORKFLOW_TAG}" \
--psu_execute_lambda_role_arn "${PSU_EXECUTE_LAMBDA_ROLE_ARN}"
fi
6 changes: 6 additions & 0 deletions .github/workflows/run_release_code_and_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ on:
pinned_image:
required: true
type: string
PSU_EXECUTE_LAMBDA_ROLE_ARN:
required: false
type: string
default: ""
secrets:
CLOUD_FORMATION_DEPLOY_ROLE:
required: true
Expand Down Expand Up @@ -241,6 +245,7 @@ jobs:
TEST_PRESCRIPTIONS_3: ${{ inputs.TEST_PRESCRIPTIONS_3 || 'noval' }}
TEST_PRESCRIPTIONS_4: ${{ inputs.TEST_PRESCRIPTIONS_4 || 'noval' }}
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
PSU_EXECUTE_LAMBDA_ROLE_ARN: ${{ inputs.PSU_EXECUTE_LAMBDA_ROLE_ARN }}
run: ./release_code.sh

- name: get mtls secrets
Expand Down Expand Up @@ -340,6 +345,7 @@ jobs:
with:
ENVIRONMENT: ${{ inputs.APIGEE_ENVIRONMENT }}
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }}
PSU_EXECUTE_LAMBDA_ROLE_ARN: ${{ inputs.PSU_EXECUTE_LAMBDA_ROLE_ARN }}
pinned_image: "${{ inputs.pinned_image }}"
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ sam-sync: guard-AWS_DEFAULT_PROFILE guard-stack_name compile
NotifyAPIBaseURLValue=$${NOTIFY_API_BASE_URL:-https://int.api.service.nhs.uk} \
EnableNotificationsInternal=$${ENABLE_NOTIFICATIONS_INTERNAL:-true} \
EnableNotificationsExternal=$${ENABLE_NOTIFICATIONS_EXTERNAL:-false} \
PsuExecuteLambdaRoleArn=$${PSU_EXECUTE_LAMBDA_ROLE_ARN:-none} \
EnableBackup=$${ENABLE_BACKUP:-False}

sam-deploy: guard-AWS_DEFAULT_PROFILE guard-stack_name
Expand Down Expand Up @@ -86,6 +87,7 @@ sam-deploy: guard-AWS_DEFAULT_PROFILE guard-stack_name
NotifyAPIBaseURLValue=$${NOTIFY_API_BASE_URL:-https://int.api.service.nhs.uk} \
EnableNotificationsInternal=$${ENABLE_NOTIFICATIONS_INTERNAL:-true} \
EnableNotificationsExternal=$${ENABLE_NOTIFICATIONS_EXTERNAL:-false} \
PsuExecuteLambdaRoleArn=$${PSU_EXECUTE_LAMBDA_ROLE_ARN:-none} \
EnableBackup=$${ENABLE_BACKUP:-False}

sam-delete: guard-AWS_DEFAULT_PROFILE guard-stack_name
Expand Down
28 changes: 28 additions & 0 deletions SAMtemplates/functions/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ Parameters:
EnableBackup:
Type: String

PsuExecuteLambdaRoleArn:
Type: String
Default: none

TestPrescriptionsParamName1:
Type: String

Expand All @@ -120,6 +124,11 @@ Conditions:
- "True"
- !Ref EnableBackup

ShouldGrantPsuExecuteLambdaInvoke: !Not
- !Equals
- !Ref PsuExecuteLambdaRoleArn
- none

Resources:
UpdatePrescriptionStatus:
Type: AWS::Serverless::Function
Expand Down Expand Up @@ -279,6 +288,25 @@ Resources:
SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole
SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream

GetStatusUpdatesInvokePolicyForRegressionRole:
Condition: ShouldGrantPsuExecuteLambdaInvoke
Type: AWS::IAM::ManagedPolicy
Properties:
Roles:
- !Select
- 1
- !Split
- "role/"
- !Ref PsuExecuteLambdaRoleArn
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource:
- !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackName}-GetStatusUpdates*

Status:
Type: AWS::Serverless::Function
Properties:
Expand Down
5 changes: 5 additions & 0 deletions SAMtemplates/main_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ Parameters:
AllowedValues:
- true
- false

PsuExecuteLambdaRoleArn:
Type: String
Default: none
Resources:
Secrets:
Type: AWS::Serverless::Application
Expand Down Expand Up @@ -273,6 +277,7 @@ Resources:
DeployCheckPrescriptionStatusUpdate: !Ref DeployCheckPrescriptionStatusUpdate
Environment: !Ref Environment
EnableBackup: !Ref EnableBackup
PsuExecuteLambdaRoleArn: !Ref PsuExecuteLambdaRoleArn
RequireApplicationName: !Ref RequireApplicationName
TestPrescriptionsParamName1: !GetAtt Parameters.Outputs.TestPrescriptionsParameterName1
TestPrescriptionsParamName2: !GetAtt Parameters.Outputs.TestPrescriptionsParameterName2
Expand Down
4 changes: 2 additions & 2 deletions zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ rules:
unpinned-images:
# these workflows use unpinned images because they are using a full image passed in that contains the tag
ignore:
- run_release_code_and_api.yml:146:18
- run_regression_tests.yml:26:18
- run_release_code_and_api.yml:150:18
- run_regression_tests.yml:30:18
- run_package_code_and_api.yml:16:18
secrets-outside-env:
# these are ignored because they are using known secrets
Expand Down
Loading