Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
e5cfae1
script
Namitha-Prabhu Nov 3, 2025
0d7458d
CCM-12180: acceptance stage internal invoke
masl2 Nov 3, 2025
4999505
CCM-12180: correct infraRepo name param
masl2 Nov 7, 2025
c021822
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
masl2 Nov 7, 2025
104851e
CCM-12180: add override project and role
masl2 Nov 7, 2025
d6c1239
CCM-12180: override project
masl2 Nov 10, 2025
a424ceb
CCM-12180: remove callerId param
masl2 Nov 10, 2025
29fdc70
fix tests
Namitha-Prabhu Nov 12, 2025
038076e
remove generate-output
Namitha-Prabhu Nov 12, 2025
223d427
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Nov 12, 2025
d18d495
tests
Namitha-Prabhu Nov 19, 2025
d161b85
merge
Namitha-Prabhu Nov 19, 2025
787face
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Nov 22, 2025
b154794
merge
Namitha-Prabhu Nov 22, 2025
10326e9
merge
Namitha-Prabhu Dec 3, 2025
d78a8c7
merge
Namitha-Prabhu Dec 3, 2025
dcead20
tests
Namitha-Prabhu Dec 5, 2025
116c323
fix unit tests
Namitha-Prabhu Dec 5, 2025
1d35f02
fix unit tests
Namitha-Prabhu Dec 5, 2025
ffdf716
fix unit tests
Namitha-Prabhu Dec 5, 2025
7e8533f
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
masl2 Dec 8, 2025
c5d9b9e
dependencies
masl2 Dec 8, 2025
20c5fd0
fix jest configurations
masl2 Dec 8, 2025
1fbbb52
event package version
masl2 Dec 8, 2025
7c57d35
lint fixes
Namitha-Prabhu Dec 8, 2025
fb0ebd9
lint fixes
Namitha-Prabhu Dec 8, 2025
9aaab4c
Merge branch 'feature/CCM-12180-TestsOnPipeline' of https://github.co…
Namitha-Prabhu Dec 8, 2025
52bf92b
remove duplicate variable defs
masl2 Dec 8, 2025
c8c3fd8
Merge branch 'feature/CCM-12180-TestsOnPipeline' of https://github.co…
Namitha-Prabhu Dec 8, 2025
4750470
remove test archive
Namitha-Prabhu Dec 9, 2025
d3aba34
suppress test data false positive
masl2 Dec 9, 2025
1adba99
imports
Namitha-Prabhu Dec 10, 2025
df1261c
checks for supplier data
Namitha-Prabhu Dec 10, 2025
7f06b68
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 10, 2025
49fd69b
tests
Namitha-Prabhu Dec 10, 2025
d0c63e1
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
masl2 Dec 11, 2025
5685221
merge
Namitha-Prabhu Dec 11, 2025
7f920cc
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 11, 2025
7636dda
Merge branch 'feature/CCM-12180-TestsOnPipeline' of https://github.co…
Namitha-Prabhu Dec 11, 2025
3e38147
version
Namitha-Prabhu Dec 11, 2025
0843041
lock file
Namitha-Prabhu Dec 11, 2025
93f72a7
lock file
Namitha-Prabhu Dec 11, 2025
f531aaf
fix
Namitha-Prabhu Dec 11, 2025
ecb88e8
fix
Namitha-Prabhu Dec 11, 2025
6bed21e
fix
Namitha-Prabhu Dec 11, 2025
5f30fa4
update test to reflect version
masl2 Dec 12, 2025
85233bf
package lock
masl2 Dec 12, 2025
7b36de2
replace js-yaml with yaml
masl2 Dec 12, 2025
48b242b
downgrade yargs due to y18n dep
masl2 Dec 12, 2025
4513c92
missing deps
masl2 Dec 12, 2025
5e1c732
update versions
Namitha-Prabhu Dec 15, 2025
3b5a35b
update versions
Namitha-Prabhu Dec 15, 2025
b1a5d66
fetch env variable
Namitha-Prabhu Dec 15, 2025
415d07a
fetch env variable
Namitha-Prabhu Dec 15, 2025
d9a5a14
PR number
Namitha-Prabhu Dec 15, 2025
a5ef09e
PR number
Namitha-Prabhu Dec 15, 2025
d470154
add flag for execute endpoint
masl2 Dec 15, 2025
52513c2
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 18, 2025
9158018
merge
Namitha-Prabhu Dec 19, 2025
b7b91d2
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 19, 2025
b9d364e
trivy job setup of node for nhs packages
masl2 Dec 19, 2025
52b3af0
lock
masl2 Dec 19, 2025
f62a004
lock
masl2 Dec 19, 2025
7196cba
verbose log level
masl2 Dec 19, 2025
832f20e
try node setup and token env
masl2 Dec 19, 2025
1947273
node setup
masl2 Dec 22, 2025
6f6cd33
acceptance deps
masl2 Dec 22, 2025
4e060b6
acceptance deps
masl2 Dec 22, 2025
7efebb6
another go
masl2 Dec 22, 2025
c232df7
another go
masl2 Dec 22, 2025
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
5 changes: 5 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENVIRONMENT=$ENV_NAME
API_KEY=
HEADERAUTH=
PR_NUMBER=prxx # remove if needs to run against main
NHSD_APIM_TOKEN=
51 changes: 51 additions & 0 deletions .github/actions/acceptance-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Acceptance tests
description: "Run acceptance tests for this repo"

inputs:
testType:
description: Type of test to run
required: true

targetEnvironment:
description: Name of the environment under test
required: true

targetAccountGroup:
description: Name of the account group under test
default: nhs-notify-template-management-dev
required: true

targetComponent:
description: Name of the component under test
required: true

runs:
using: "composite"

steps:
- name: Fetch terraform output
uses: actions/download-artifact@v5
with:
name: terraform-output-${{ inputs.targetComponent }}

- name: Get Node version
id: nodejs_version
shell: bash
run: |
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT

- name: "Repo setup"
uses: ./.github/actions/node-install
with:
node-version: ${{ steps.nodejs_version.outputs.nodejs_version }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}

- name: "Set PR NUMBER"
shell: bash
run: |
echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV

- name: Run test - ${{ inputs.testType }}
shell: bash
run: |
make test-${{ inputs.testType }}
3 changes: 3 additions & 0 deletions .github/actions/test-types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"component"
]
7 changes: 7 additions & 0 deletions .github/workflows/stage-1-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,16 @@ jobs:
timeout-minutes: 10
needs: detect-terraform-changes
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: 'https://npm.pkg.github.com'
- name: "Setup ASDF"
uses: asdf-vm/actions/setup@v4
- name: "Perform Setup"
Expand Down
170 changes: 27 additions & 143 deletions .github/workflows/stage-4-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,152 +35,36 @@ on:
required: true
type: string

jobs:
# environment-set-up:
# name: "Environment set up"
# runs-on: ubuntu-latest
# timeout-minutes: 5
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Create infractructure"
# run: |
# echo "Creating infractructure..."
# - name: "Update database"
# run: |
# echo "Updating database..."
# - name: "Deploy application"
# run: |
# echo "Deploying application..."
permissions:
id-token: write
contents: read

test-contract:
name: "Contract test"
jobs:
run-acceptance-tests:
name: Run Acceptance Tests
runs-on: ubuntu-latest
# needs: environment-set-up
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Cache node_modules"
uses: actions/cache@v4
- uses: actions/checkout@v5.0.0

- name: 'Use Node.js'
uses: actions/setup-node@v6
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Run contract test"
run: |
make test-contract
node-version: '${{ inputs.nodejs_version }}'
registry-url: 'https://npm.pkg.github.com'
scope: '@nhsdigital'

- name: Trigger Acceptance Tests
shell: bash
env:
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Save result"
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Nothing to save"

# Environment-based tests should run from notify-internal repo, not in public repo
# test-security:
# name: "Security test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run security test"
# run: |
# make test-security
# - name: "Save result"
# run: |
# echo "Nothing to save"
# test-ui:
# name: "UI test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run UI test"
# run: |
# make test-ui
# - name: "Save result"
# run: |
# echo "Nothing to save"
# test-ui-performance:
# name: "UI performance test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run UI performance test"
# run: |
# make test-ui-performance
# - name: "Save result"
# run: |
# echo "Nothing to save"
# test-integration:
# name: "Integration test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run integration test"
# run: |
# make test-integration
# - name: "Save result"
# run: |
# echo "Nothing to save"
# test-accessibility:
# name: "Accessibility test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run accessibility test"
# run: |
# make test-accessibility
# - name: "Save result"
# run: |
# echo "Nothing to save"
# test-load:
# name: "Load test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run load tests"
# run: |
# make test-load
# - name: "Save result"
# run: |
# echo "Nothing to save"
# environment-tear-down:
# name: "Environment tear down"
# runs-on: ubuntu-latest
# needs:
# [
# test-accessibility,
# test-contract,
# test-integration,
# test-load,
# test-security,
# test-ui-performance,
# test-ui,
# ]
# if: always()
# timeout-minutes: 5
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Tear down environment"
# run: |
# echo "Tearing down environment..."
.github/scripts/dispatch_internal_repo_workflow.sh \
--targetWorkflow "dispatch-contextual-tests-dynamic-env.yaml" \
--infraRepoName "nhs-notify-supplier-api" \
--releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \
--overrideProjectName "nhs" \
--targetEnvironment "pr${{ inputs.pr_number }}" \
--targetAccountGroup "nhs-notify-supplier-api-dev" \
--targetComponent "api"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version.json
# Please, add your custom content below!
.idea
.env
.envrc

# dependencies
node_modules
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
"cSpell.words": [
"envrc"
],
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
Expand Down
19 changes: 15 additions & 4 deletions docs/assets/diagrams/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,27 @@ erDiagram
erDiagram
MI {
string id
string supplierId "ref: Supplier"
string specificationId
string groupId
string lineItem
string timestamp
number quantity
string specificationId
string groupId
number stockRemaining
string supplierId
string createdAt
string updatedAt
number ttl "min: -9007199254740991, max: 9007199254740991"
}
```

## Supplier schema

```mermaid
erDiagram
Supplier {
string id
string name
string apimId
string status "enum: ENABLED, DISABLED"
}
MI }o--|| Supplier : "supplierId"
```
3 changes: 3 additions & 0 deletions infrastructure/terraform/components/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ No requirements.
|------|-------------|------|---------|:--------:|
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes |
| <a name="input_ca_pem_filename"></a> [ca\_pem\_filename](#input\_ca\_pem\_filename) | Filename for the CA truststore file within the s3 bucket | `string` | `null` | no |
| <a name="input_commit_id"></a> [commit\_id](#input\_commit\_id) | The commit to deploy. Must be in the tree for branch\_name | `string` | `"HEAD"` | no |
| <a name="input_component"></a> [component](#input\_component) | The variable encapsulating the name of this component | `string` | `"supapi"` | no |
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A map of default tags to apply to all taggable resources within the component | `map(string)` | `{}` | no |
| <a name="input_disable_gateway_execute_endpoint"></a> [disable\_gateway\_execute\_endpoint](#input\_disable\_gateway\_execute\_endpoint) | Disable the execution endpoint for the API Gateway | `bool` | `true` | no |
| <a name="input_enable_backups"></a> [enable\_backups](#input\_enable\_backups) | Enable backups | `bool` | `false` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the tfscaffold environment | `string` | n/a | yes |
| <a name="input_eventpub_control_plane_bus_arn"></a> [eventpub\_control\_plane\_bus\_arn](#input\_eventpub\_control\_plane\_bus\_arn) | ARN of the EventBridge control plane bus for eventpub | `string` | `""` | no |
Expand Down Expand Up @@ -59,6 +61,7 @@ No requirements.
| Name | Description |
|------|-------------|
| <a name="output_api_urll"></a> [api\_urll](#output\_api\_urll) | n/a |
| <a name="output_deployment"></a> [deployment](#output\_deployment) | Deployment details used for post-deployment scripts |
<!-- vale on -->
<!-- markdownlint-enable -->
<!-- END_TF_DOCS -->
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ resource "aws_api_gateway_rest_api" "main" {
name = local.csi
body = local.openapi_spec
description = "Suppliers API"
disable_execute_api_endpoint = true
disable_execute_api_endpoint = var.disable_gateway_execute_endpoint
}
13 changes: 13 additions & 0 deletions infrastructure/terraform/components/api/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
output "api_urll" {
value = aws_api_gateway_stage.main.invoke_url
}

output "deployment" {
description = "Deployment details used for post-deployment scripts"
value = {
aws_region = var.region
aws_account_id = var.aws_account_id
project = var.project
environment = var.environment
group = var.group
component = var.component
commit_id = var.commit_id
}
}
2 changes: 1 addition & 1 deletion infrastructure/terraform/components/api/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ROOT_DIR/scripts/set-github-token.sh

echo "Completed."

npm ci
npm ci --loglevel verbose

npm run generate-dependencies --workspaces --if-present

Expand Down
Loading
Loading