Skip to content

Commit 0d7458d

Browse files
committed
CCM-12180: acceptance stage internal invoke
1 parent e5cfae1 commit 0d7458d

File tree

6 files changed

+137
-172
lines changed

6 files changed

+137
-172
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Acceptance tests
2+
description: "Run acceptance tests for this repo"
3+
4+
inputs:
5+
testType:
6+
description: Type of test to run
7+
required: true
8+
9+
targetEnvironment:
10+
description: Name of the environment under test
11+
required: true
12+
13+
targetAccountGroup:
14+
description: Name of the account group under test
15+
default: nhs-notify-template-management-dev
16+
required: true
17+
18+
targetComponent:
19+
description: Name of the component under test
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
25+
steps:
26+
- name: Fetch terraform output
27+
uses: actions/download-artifact@v5
28+
with:
29+
name: terraform-output-${{ inputs.targetComponent }}
30+
31+
- name: "Repo setup"
32+
shell: bash
33+
run: |
34+
npm ci
35+
36+
- name: Generate outputs file
37+
shell: bash
38+
run: |
39+
root_dir=${GITHUB_WORKSPACE}
40+
mv ./terraform_output.json ./sandbox_tf_outputs.json
41+
npm run generate-outputs sandbox-output
42+
43+
- name: Run test - ${{ inputs.testType }}
44+
shell: bash
45+
run: |
46+
make test-${{ inputs.testType }}
47+
48+
- name: Archive test results
49+
uses: actions/upload-artifact@v4
50+
if: always()
51+
with:
52+
name: ${{ inputs.testType }} - test report
53+
path: "tests/acceptance-test-report"

.github/actions/test-types.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"component"
3+
]

.github/workflows/stage-4-acceptance.yaml

Lines changed: 21 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -35,139 +35,27 @@ on:
3535
required: true
3636
type: string
3737

38+
permissions:
39+
id-token: write
40+
contents: read
41+
3842
jobs:
39-
environment-set-up:
40-
name: "Environment set up"
41-
runs-on: ubuntu-latest
42-
timeout-minutes: 5
43-
steps:
44-
- name: "Checkout code"
45-
uses: actions/checkout@v5
46-
- name: "Create infractructure"
47-
run: |
48-
echo "Creating infractructure..."
49-
- name: "Update database"
50-
run: |
51-
echo "Updating database..."
52-
- name: "Deploy application"
53-
run: |
54-
echo "Deploying application..."
55-
test-contract:
56-
name: "Contract test"
57-
runs-on: ubuntu-latest
58-
needs: environment-set-up
59-
timeout-minutes: 10
60-
steps:
61-
- name: "Checkout code"
62-
uses: actions/checkout@v5
63-
- name: "Run contract test"
64-
run: |
65-
make test-contract
66-
- name: "Save result"
67-
run: |
68-
echo "Nothing to save"
69-
test-security:
70-
name: "Security test"
71-
runs-on: ubuntu-latest
72-
needs: environment-set-up
73-
timeout-minutes: 10
74-
steps:
75-
- name: "Checkout code"
76-
uses: actions/checkout@v5
77-
- name: "Run security test"
78-
run: |
79-
make test-security
80-
- name: "Save result"
81-
run: |
82-
echo "Nothing to save"
83-
test-ui:
84-
name: "UI test"
85-
runs-on: ubuntu-latest
86-
needs: environment-set-up
87-
timeout-minutes: 10
88-
steps:
89-
- name: "Checkout code"
90-
uses: actions/checkout@v5
91-
- name: "Run UI test"
92-
run: |
93-
make test-ui
94-
- name: "Save result"
95-
run: |
96-
echo "Nothing to save"
97-
test-ui-performance:
98-
name: "UI performance test"
43+
run-acceptance-tests:
44+
name: Run Acceptance Tests
9945
runs-on: ubuntu-latest
100-
needs: environment-set-up
101-
timeout-minutes: 10
10246
steps:
103-
- name: "Checkout code"
104-
uses: actions/checkout@v5
105-
- name: "Run UI performance test"
106-
run: |
107-
make test-ui-performance
108-
- name: "Save result"
109-
run: |
110-
echo "Nothing to save"
111-
test-integration:
112-
name: "Integration test"
113-
runs-on: ubuntu-latest
114-
needs: environment-set-up
115-
timeout-minutes: 10
116-
steps:
117-
- name: "Checkout code"
118-
uses: actions/checkout@v5
119-
- name: "Run integration test"
120-
run: |
121-
make test-integration
122-
- name: "Save result"
123-
run: |
124-
echo "Nothing to save"
125-
test-accessibility:
126-
name: "Accessibility test"
127-
runs-on: ubuntu-latest
128-
needs: environment-set-up
129-
timeout-minutes: 10
130-
steps:
131-
- name: "Checkout code"
132-
uses: actions/checkout@v5
133-
- name: "Run accessibility test"
134-
run: |
135-
make test-accessibility
136-
- name: "Save result"
137-
run: |
138-
echo "Nothing to save"
139-
test-load:
140-
name: "Load test"
141-
runs-on: ubuntu-latest
142-
needs: environment-set-up
143-
timeout-minutes: 10
144-
steps:
145-
- name: "Checkout code"
146-
uses: actions/checkout@v5
147-
- name: "Run load tests"
148-
run: |
149-
make test-load
150-
- name: "Save result"
151-
run: |
152-
echo "Nothing to save"
153-
environment-tear-down:
154-
name: "Environment tear down"
155-
runs-on: ubuntu-latest
156-
needs:
157-
[
158-
test-accessibility,
159-
test-contract,
160-
test-integration,
161-
test-load,
162-
test-security,
163-
test-ui-performance,
164-
test-ui,
165-
]
166-
if: always()
167-
timeout-minutes: 5
168-
steps:
169-
- name: "Checkout code"
170-
uses: actions/checkout@v5
171-
- name: "Tear down environment"
172-
run: |
173-
echo "Tearing down environment..."
47+
- uses: actions/[email protected]
48+
49+
- name: Trigger Acceptance Tests
50+
shell: bash
51+
env:
52+
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
53+
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
54+
run: |
55+
.github/scripts/dispatch_internal_repo_workflow.sh \
56+
--infraRepoName "nhs-notify-web-template-management" \
57+
--releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \
58+
--targetWorkflow "dispatch-contextual-tests-dynamic-env.yaml" \
59+
--targetEnvironment "pr${{ inputs.pr_number }}" \
60+
--targetAccountGroup "nhs-notify-supplier-api-dev" \
61+
--targetComponent "api"

infrastructure/terraform/components/api/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ No requirements.
1111
|------|-------------|------|---------|:--------:|
1212
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes |
1313
| <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 |
14+
| <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 |
1415
| <a name="input_component"></a> [component](#input\_component) | The variable encapsulating the name of this component | `string` | `"supapi"` | no |
1516
| <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 |
1617
| <a name="input_enable_backups"></a> [enable\_backups](#input\_enable\_backups) | Enable backups | `bool` | `false` | no |
@@ -48,6 +49,7 @@ No requirements.
4849
| Name | Description |
4950
|------|-------------|
5051
| <a name="output_api_urll"></a> [api\_urll](#output\_api\_urll) | n/a |
52+
| <a name="output_deployment"></a> [deployment](#output\_deployment) | Deployment details used for post-deployment scripts |
5153
<!-- vale on -->
5254
<!-- markdownlint-enable -->
5355
<!-- END_TF_DOCS -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
output "api_urll" {
22
value = aws_api_gateway_stage.main.invoke_url
33
}
4+
5+
output "deployment" {
6+
description = "Deployment details used for post-deployment scripts"
7+
value = {
8+
aws_region = var.region
9+
aws_account_id = var.aws_account_id
10+
project = var.project
11+
environment = var.environment
12+
group = var.group
13+
component = var.component
14+
commit_id = var.commit_id
15+
}
16+
}

infrastructure/terraform/components/api/variables.tf

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,64 +51,40 @@ variable "default_tags" {
5151
# Variables specific to the component
5252
##
5353

54-
variable "kms_deletion_window" {
54+
variable "ca_pem_filename" {
5555
type = string
56-
description = "When a kms key is deleted, how long should it wait in the pending deletion state?"
57-
default = "30"
58-
}
59-
60-
variable "log_retention_in_days" {
61-
type = number
62-
description = "The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite"
63-
default = 0
56+
description = "Filename for the CA truststore file within the s3 bucket"
57+
default = null
6458
}
6559

66-
variable "log_level" {
60+
variable "commit_id" {
6761
type = string
68-
description = "The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels"
69-
default = "INFO"
62+
description = "The commit to deploy. Must be in the tree for branch_name"
63+
default = "HEAD"
7064
}
7165

72-
variable "force_lambda_code_deploy" {
66+
variable "enable_backups" {
7367
type = bool
74-
description = "If the lambda package in s3 has the same commit id tag as the terraform build branch, the lambda will not update automatically. Set to True if making changes to Lambda code from on the same commit for example during development"
68+
description = "Enable backups"
7569
default = false
7670
}
7771

78-
variable "parent_acct_environment" {
79-
type = string
80-
description = "Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments"
81-
default = "main"
82-
}
83-
84-
variable "shared_infra_account_id" {
85-
type = string
86-
description = "The AWS Account ID of the shared infrastructure account"
87-
default = "000000000000"
88-
}
89-
90-
variable "manually_configure_mtls_truststore" {
72+
variable "force_destroy" {
9173
type = bool
92-
description = "Manually manage the truststore used for API Gateway mTLS (e.g. for prod environment)"
74+
description = "Flag to force deletion of S3 buckets"
9375
default = false
9476
}
9577

96-
variable "enable_backups" {
78+
variable "force_lambda_code_deploy" {
9779
type = bool
98-
description = "Enable backups"
80+
description = "If the lambda package in s3 has the same commit id tag as the terraform build branch, the lambda will not update automatically. Set to True if making changes to Lambda code from on the same commit for example during development"
9981
default = false
10082
}
10183

102-
variable "ca_pem_filename" {
84+
variable "kms_deletion_window" {
10385
type = string
104-
description = "Filename for the CA truststore file within the s3 bucket"
105-
default = null
106-
}
107-
108-
variable "force_destroy" {
109-
type = bool
110-
description = "Flag to force deletion of S3 buckets"
111-
default = false
86+
description = "When a kms key is deleted, how long should it wait in the pending deletion state?"
87+
default = "30"
11288
}
11389

11490
variable "letter_table_ttl_hours" {
@@ -117,8 +93,38 @@ variable "letter_table_ttl_hours" {
11793
default = 24
11894
}
11995

96+
variable "log_level" {
97+
type = string
98+
description = "The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels"
99+
default = "INFO"
100+
}
101+
102+
variable "log_retention_in_days" {
103+
type = number
104+
description = "The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite"
105+
default = 0
106+
}
107+
108+
variable "manually_configure_mtls_truststore" {
109+
type = bool
110+
description = "Manually manage the truststore used for API Gateway mTLS (e.g. for prod environment)"
111+
default = false
112+
}
113+
120114
variable "max_get_limit" {
121115
type = number
122116
description = "Default limit to apply to GET requests that support pagination"
123117
default = 2500
124118
}
119+
120+
variable "parent_acct_environment" {
121+
type = string
122+
description = "Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments"
123+
default = "main"
124+
}
125+
126+
variable "shared_infra_account_id" {
127+
type = string
128+
description = "The AWS Account ID of the shared infrastructure account"
129+
default = "000000000000"
130+
}

0 commit comments

Comments
 (0)