Skip to content

Commit 2bcf49e

Browse files
committed
Merge branch 'master' into VED-000-consistent-error-format
2 parents 491873a + 83a9491 commit 2bcf49e

File tree

446 files changed

+29874
-12881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

446 files changed

+29874
-12881
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: 2
77
updates:
88
- package-ecosystem: "docker"
99
directories:
10-
- "/ack_backend"
10+
- "/lambdas/ack_backend"
1111
- "/delta_backend"
1212
- "/filenameprocessor"
1313
- "/grafana/non-prod/docker"
@@ -49,14 +49,19 @@ updates:
4949
- package-ecosystem: "pip"
5050
directories:
5151
- "/"
52-
- "/ack_backend"
5352
- "/backend"
53+
- "/batch_processor_filter"
5454
- "/delta_backend"
5555
- "/e2e"
5656
- "/e2e_batch"
5757
- "/filenameprocessor"
5858
- "/mesh_processor"
5959
- "/recordprocessor"
60+
- "/lambdas/ack_backend"
61+
- "/lambdas/redis_sync"
62+
- "/lambdas/id_sync"
63+
- "/lambdas/mns_subscription"
64+
- "/lambdas/shared"
6065
schedule:
6166
interval: "daily"
6267
open-pull-requests-limit: 1
@@ -70,7 +75,6 @@ updates:
7075
directories:
7176
- "/grafana/non-prod/terraform"
7277
- "/infra"
73-
- "/mesh-infra"
7478
- "/terraform"
7579
- "/terraform_aws_backup/**"
7680
schedule:

.github/workflows/continuous-disintegration.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/continuous-integration.yml renamed to .github/workflows/create-release-tag.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
name: Create Release
2-
on: push
1+
name: Create Release Tag
2+
on:
3+
push:
4+
branches:
5+
- master
36

47
jobs:
58
create_release:
6-
name: build
9+
name: Create Release
710
runs-on: ubuntu-latest
8-
if: github.ref == 'refs/heads/master'
911
steps:
1012
- name: Checkout
11-
uses: actions/checkout@v4
13+
uses: actions/checkout@v5
1214
with:
1315
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
1416

@@ -40,4 +42,4 @@ jobs:
4042
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4143
with:
4244
tag_name: ${{ env.SPEC_VERSION }}
43-
release_name: ${{ env.SPEC_VERSION }}
45+
release_name: ${{ env.SPEC_VERSION }}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Deploy Backend
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
apigee_environment:
7+
required: true
8+
type: string
9+
create_mns_subscription:
10+
required: false
11+
type: boolean
12+
default: true
13+
environment:
14+
required: true
15+
type: string
16+
sub_environment:
17+
required: true
18+
type: string
19+
workflow_dispatch:
20+
inputs:
21+
apigee_environment:
22+
type: choice
23+
description: Select the Apigee proxy environment
24+
options:
25+
- internal-dev
26+
- int
27+
- ref
28+
- prod
29+
create_mns_subscription:
30+
description: Create an MNS Subscription. Only available in dev
31+
required: false
32+
type: boolean
33+
default: true
34+
environment:
35+
type: string
36+
description: Select the backend environment
37+
options:
38+
- dev
39+
- preprod
40+
- prod
41+
sub_environment:
42+
type: string
43+
description: Set the sub environment name e.g. pr-xxx, or green/blue in higher environments
44+
45+
jobs:
46+
terraform-plan:
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: ${{ inputs.environment }}
50+
env: # Sonarcloud - do not allow direct usage of untrusted data
51+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
52+
BACKEND_ENVIRONMENT: ${{ inputs.environment }}
53+
BACKEND_SUB_ENVIRONMENT: ${{ inputs.sub_environment }}
54+
permissions:
55+
id-token: write
56+
contents: read
57+
steps:
58+
- name: Connect to AWS
59+
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838
60+
with:
61+
aws-region: eu-west-2
62+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
63+
role-session-name: github-actions
64+
65+
- name: Whoami
66+
run: aws sts get-caller-identity
67+
68+
- name: Checkout
69+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
70+
71+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
72+
with:
73+
terraform_version: "1.12.2"
74+
75+
- name: Terraform Init
76+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
77+
run: make init apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
78+
79+
- name: Terraform Plan
80+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
81+
run: make plan-ci apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
82+
83+
- name: Save Terraform Plan
84+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
85+
with:
86+
name: tfplan
87+
path: ${{ vars.TERRAFORM_DIR_PATH }}/tfplan
88+
89+
terraform-apply:
90+
needs: terraform-plan
91+
runs-on: ubuntu-latest
92+
environment:
93+
name: ${{ inputs.environment }}
94+
env: # Sonarcloud - do not allow direct usage of untrusted data
95+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
96+
BACKEND_ENVIRONMENT: ${{ inputs.environment }}
97+
BACKEND_SUB_ENVIRONMENT: ${{ inputs.sub_environment }}
98+
permissions:
99+
id-token: write
100+
contents: read
101+
steps:
102+
- name: Checkout
103+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
104+
105+
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a
106+
with:
107+
aws-region: eu-west-2
108+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
109+
role-session-name: github-actions
110+
111+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
112+
with:
113+
terraform_version: "1.12.2"
114+
115+
- name: Retrieve Terraform Plan
116+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
117+
with:
118+
name: tfplan
119+
path: ${{ vars.TERRAFORM_DIR_PATH }}
120+
121+
- name: Terraform Init
122+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
123+
run: make init apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
124+
125+
- name: Terraform Apply
126+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
127+
run: |
128+
make apply-ci apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
129+
echo "ID_SYNC_QUEUE_ARN=$(make -s output name=id_sync_queue_arn)" >> $GITHUB_ENV
130+
131+
- name: Install poetry
132+
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
133+
run: pip install poetry==2.1.4
134+
135+
- uses: actions/setup-python@v5
136+
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
137+
with:
138+
python-version: 3.11
139+
cache: 'poetry'
140+
141+
- name: Create MNS Subscription
142+
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
143+
working-directory: './lambdas/mns_subscription'
144+
env:
145+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
146+
SQS_ARN: ${{ env.ID_SYNC_QUEUE_ARN }}
147+
run: |
148+
poetry install --no-root
149+
echo "Subscribing SQS to MNS for notifications..."
150+
make subscribe
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Create PR JIRA Link
2+
on:
3+
pull_request:
4+
types: [opened]
5+
6+
jobs:
7+
link-ticket:
8+
runs-on: ubuntu-latest
9+
env:
10+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
11+
steps:
12+
- name: Check ticket name conforms to requirements
13+
run: echo $BRANCH_NAME | grep -i -E -q "(ved-[0-9]+)|(dependabot\/)"
14+
continue-on-error: true
15+
16+
- name: Grab ticket name
17+
run: echo "TICKET_NAME=$(echo $BRANCH_NAME | grep -i -o '\(ved-[0-9]\+\)' | tr '[:lower:]' '[:upper:]')" >> $GITHUB_ENV
18+
continue-on-error: true
19+
20+
- name: Comment on PR with link to JIRA ticket
21+
if: contains(env.TICKET_NAME, 'VED-')
22+
continue-on-error: true
23+
uses: unsplash/comment-on-pr@a9bf050e744c8282dee4bb0dbcf063186d8316c4
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
msg: |
28+
This branch is working on a ticket in the NHS England VED JIRA Project. Here's a handy link to the ticket:
29+
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME}})

.github/workflows/pr-lint.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/pr-teardown.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: PR Teardown
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: The PR number of the environment to teardown e.g 123
10+
required: true
11+
type: string
12+
13+
jobs:
14+
teardown:
15+
name: PR Teardown
16+
runs-on: ubuntu-latest
17+
environment:
18+
name: dev
19+
env:
20+
APIGEE_ENVIRONMENT: internal-dev
21+
BACKEND_ENVIRONMENT: dev
22+
BACKEND_SUB_ENVIRONMENT: pr-${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.pr_number }}
23+
permissions:
24+
id-token: write
25+
contents: read
26+
27+
steps:
28+
- name: Connect to AWS
29+
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838
30+
with:
31+
aws-region: eu-west-2
32+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
33+
role-session-name: github-actions
34+
35+
- name: Whoami
36+
run: aws sts get-caller-identity
37+
38+
- name: Checkout
39+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
40+
41+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
42+
with:
43+
terraform_version: "1.12.2"
44+
45+
- name: Terraform Init and extract MNS SQS QUEUE ARN
46+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
47+
run: |
48+
make init apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
49+
make workspace apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT
50+
echo "ID_SYNC_QUEUE_ARN=$(make -s output name=id_sync_queue_arn)" >> $GITHUB_ENV
51+
52+
- name: Install poetry
53+
run: pip install poetry==2.1.4
54+
55+
- uses: actions/setup-python@v5
56+
with:
57+
python-version: 3.11
58+
cache: 'poetry'
59+
60+
- name: Unsubscribe MNS
61+
working-directory: './lambdas/mns_subscription'
62+
env:
63+
SQS_ARN: ${{ env.ID_SYNC_QUEUE_ARN }}
64+
run: |
65+
poetry install --no-root
66+
67+
echo "Unsubscribing SQS to MNS for notifications..."
68+
make unsubscribe
69+
70+
- name: Terraform Destroy
71+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
72+
run: |
73+
make destroy apigee_environment=$APIGEE_ENVIRONMENT environment=$BACKEND_ENVIRONMENT sub_environment=$BACKEND_SUB_ENVIRONMENT

0 commit comments

Comments
 (0)