Skip to content

Commit 3938451

Browse files
Merge branch 'main' into feature/APIM-tests
2 parents 543fd8b + 2a2801a commit 3938451

44 files changed

Lines changed: 16382 additions & 16277 deletions

Some content is hidden

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

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ generated_code = true
7070

7171
[/internal/events/**/*.schema.json]
7272
insert_final_newline = unset
73+
74+
[/pact-contracts/pacts/**/*.json]
75+
insert_final_newline = unset
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'npm install and setup'
2+
description: 'Setup node, authenticate github package repository and perform clean npm install'
3+
4+
inputs:
5+
node-version:
6+
description: 'Node.js version'
7+
required: true
8+
GITHUB_TOKEN:
9+
description: "Token for access to github package registry"
10+
required: true
11+
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: 'Use Node.js'
16+
uses: actions/setup-node@v6
17+
with:
18+
node-version: '${{ inputs.node-version }}'
19+
registry-url: 'https://npm.pkg.github.com'
20+
scope: '@nhsdigital'
21+
22+
- name: 'Install dependencies'
23+
shell: bash
24+
env:
25+
NODE_AUTH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
26+
run: |
27+
npm ci

.github/workflows/stage-1-commit.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ jobs:
152152
timeout-minutes: 10
153153
needs: detect-terraform-changes
154154
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
155+
env:
156+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155157
steps:
156158
- name: "Checkout code"
157159
uses: actions/checkout@v5
160+
- name: Setup NodeJS
161+
uses: actions/setup-node@v4
162+
with:
163+
node-version: ${{ inputs.nodejs_version }}
164+
registry-url: 'https://npm.pkg.github.com'
158165
- name: "Setup ASDF"
159166
uses: asdf-vm/actions/setup@v4
160167
- name: "Perform Setup"

.github/workflows/stage-2-test.yaml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ jobs:
5858
restore-keys: |
5959
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
6060
- name: "Repo setup"
61-
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
run: |
64-
npm ci
61+
uses: ./.github/actions/node-install
62+
with:
63+
node-version: ${{ inputs.nodejs_version }}
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6565
- name: "Generate dependencies"
6666
run: |
6767
npm run generate-dependencies --workspaces --if-present
@@ -82,10 +82,10 @@ jobs:
8282
restore-keys: |
8383
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
8484
- name: "Repo setup"
85-
env:
86-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87-
run: |
88-
npm ci
85+
uses: ./.github/actions/node-install
86+
with:
87+
node-version: ${{ inputs.nodejs_version }}
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8989
- name: "Generate dependencies"
9090
run: |
9191
npm run generate-dependencies --workspaces --if-present
@@ -104,6 +104,37 @@ jobs:
104104
with:
105105
name: code-coverage-report
106106
path: ".reports/lcov.info"
107+
test-pact:
108+
name: "Pact tests"
109+
runs-on: ubuntu-latest
110+
timeout-minutes: 5
111+
env:
112+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
permissions:
114+
packages: write
115+
contents: read
116+
steps:
117+
- name: "Checkout code"
118+
uses: actions/checkout@v5
119+
- name: "Cache node_modules"
120+
uses: actions/cache@v4
121+
with:
122+
path: |
123+
**/node_modules
124+
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
125+
restore-keys: |
126+
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
127+
- name: "Repo setup"
128+
uses: ./.github/actions/node-install
129+
with:
130+
node-version: ${{ inputs.nodejs_version }}
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
- name: "Generate dependencies"
133+
run: npm run generate-dependencies --workspaces --if-present
134+
- name: "Run PACT tests"
135+
run: npm run test:pact --workspace tests
136+
- name: Publish Pact Contracts
137+
run: ./scripts/publish-pact-contracts.sh
107138
test-lint:
108139
name: "Linting"
109140
runs-on: ubuntu-latest
@@ -120,10 +151,10 @@ jobs:
120151
restore-keys: |
121152
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
122153
- name: "Repo setup"
123-
env:
124-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125-
run: |
126-
npm ci
154+
uses: ./.github/actions/node-install
155+
with:
156+
node-version: ${{ inputs.nodejs_version }}
157+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127158
- name: "Generate dependencies"
128159
run: |
129160
npm run generate-dependencies --workspaces --if-present
@@ -146,10 +177,10 @@ jobs:
146177
restore-keys: |
147178
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
148179
- name: "Repo setup"
149-
env:
150-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151-
run: |
152-
npm ci
180+
uses: ./.github/actions/node-install
181+
with:
182+
node-version: ${{ inputs.nodejs_version }}
183+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153184
- name: "Generate dependencies"
154185
run: |
155186
npm run generate-dependencies --workspaces --if-present

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ dist
3232
/specification/api/components/security/security.yml
3333
/specification/api/components/parameters/authorization/authorization.yml
3434
/scripts/JWT/*.pem
35+
36+
# ignore PACTS
37+
.pacts

.gitleaksignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ d8aaf7e033bf78fff491caa148897be266b60f67:src/src.sln:ipv4:3
1818
e12407e09151898bfd8d049d57eee9db9977d56b:.github/copilot-instructions.md:generic-api-key:213
1919
4ad86108d4e08cd410061e8842dd3a2b3bee4867:scripts/JWT/README.md:generic-api-key:38
2020
504844c9838740c8c5235024919f0775ad817cde:pact-contracts/pacts/letter-rendering/supplier-api-letter-request-prepared.json:generic-api-key:10
21+
82cf3b2e89ea24b97c4ffc09e618700fb1b0aff3:pact-contracts/pacts/letter-rendering/supplier-api-letter-request-prepared.json:generic-api-key:10
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
resource "aws_lambda_event_source_mapping" "letter_updates_transformer_kinesis" {
2-
event_source_arn = aws_kinesis_stream.letter_change_stream.arn
3-
function_name = module.letter_updates_transformer.function_arn
4-
starting_position = "LATEST"
5-
batch_size = 10
6-
maximum_batching_window_in_seconds = 1
2+
event_source_arn = aws_kinesis_stream.letter_change_stream.arn
3+
function_name = module.letter_updates_transformer.function_arn
4+
starting_position = "LATEST"
5+
batch_size = 10
6+
maximum_batching_window_in_seconds = 1
77

88
depends_on = [
9-
module.letter_updates_transformer # ensures updates transformer exists
9+
module.letter_updates_transformer # ensures updates transformer exists
1010
]
1111
}

infrastructure/terraform/components/api/locals.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ locals {
2828
APIM_CORRELATION_HEADER = "nhsd-correlation-id",
2929
DOWNLOAD_URL_TTL_SECONDS = 60
3030
}
31+
32+
core_pdf_bucket_arn = "arn:aws:s3:::comms-${var.core_account_id}-eu-west-2-${var.core_environment}-api-stg-pdf-pipeline"
33+
core_s3_kms_key_alias_name = "alias/comms-${var.core_environment}-api-s3"
3134
}

infrastructure/terraform/components/api/module_authorizer_lambda.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "authorizer_lambda" {
2-
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.26/terraform-lambda.zip"
2+
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip"
33

44
aws_account_id = var.aws_account_id
55
component = var.component
@@ -31,7 +31,6 @@ module "authorizer_lambda" {
3131
enable_lambda_insights = false
3232
force_lambda_code_deploy = var.force_lambda_code_deploy
3333

34-
send_to_firehose = true
3534
log_destination_arn = local.destination_arn
3635
log_subscription_role_arn = local.acct.log_subscription_role_arn
3736

infrastructure/terraform/components/api/module_lambda_get_letter.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "get_letter" {
2-
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.26/terraform-lambda.zip"
2+
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip"
33

44
function_name = "get_letter"
55
description = "Get letter status"
@@ -31,7 +31,6 @@ module "get_letter" {
3131
force_lambda_code_deploy = var.force_lambda_code_deploy
3232
enable_lambda_insights = false
3333

34-
send_to_firehose = true
3534
log_destination_arn = local.destination_arn
3635
log_subscription_role_arn = local.acct.log_subscription_role_arn
3736

0 commit comments

Comments
 (0)