Skip to content

Commit a4e72d9

Browse files
Merge branch 'main' into task/FTRS-2587-data-migration-toggles
2 parents 7a9aa85 + e9d8187 commit a4e72d9

File tree

28 files changed

+278
-64
lines changed

28 files changed

+278
-64
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Proxygen Pytest APIM Token Auth'
2+
description: 'Request pytest APIM token from Proxygen and export it as environment variable'
3+
4+
inputs:
5+
api_name:
6+
description: 'Name of the API to access via Proxygen'
7+
required: true
8+
access_token:
9+
description: 'Access token for Proxygen API'
10+
required: true
11+
proxygen_base_url:
12+
description: 'Base URL for Proxygen API'
13+
required: true
14+
15+
runs:
16+
using: 'composite'
17+
steps:
18+
- name: Fetch and export pytest APIM token
19+
shell: bash
20+
env:
21+
API_NAME: ${{ inputs.api_name }}
22+
ACCESS_TOKEN: ${{ inputs.access_token }}
23+
PROXYGEN_BASE_URL: ${{ inputs.proxygen_base_url }}
24+
run: |
25+
# Mask secrets as early as possible
26+
echo "::add-mask::$ACCESS_TOKEN"
27+
28+
APIGEE_ACCESS_TOKEN=$("${{ github.workspace }}/scripts/workflow/fetch-apigee-token.sh")
29+
30+
echo "::add-mask::$APIGEE_ACCESS_TOKEN"
31+
echo "APIGEE_ACCESS_TOKEN=$APIGEE_ACCESS_TOKEN" >> "$GITHUB_ENV"
32+
echo "✓ Apigee access token retrieved and exported successfully"

.github/actions/configure-credentials/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runs:
1919
using: "composite"
2020
steps:
2121
- name: Configure AWS Credentials
22-
uses: aws-actions/configure-aws-credentials@v5.1.1
22+
uses: aws-actions/configure-aws-credentials@v6.0.0
2323
with:
2424
role-to-assume: arn:aws:iam::${{ inputs.aws_account_id }}:role/${{ github.event.repository.name }}${{ inputs.environment != 'mgmt' && format('-{0}', inputs.environment) || '' }}-${{ inputs.type }}-github-runner
2525
role-session-name: github-pipeline-session

.github/actions/create-lines-of-code-report/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ runs:
4444
echo "secrets_exist=${{ inputs.idp_aws_report_upload_role_name != '' && inputs.idp_aws_report_upload_bucket_endpoint != '' }}" >> $GITHUB_OUTPUT
4545
- name: "Authenticate to send the report"
4646
if: steps.check.outputs.secrets_exist == 'true'
47-
uses: aws-actions/configure-aws-credentials@v2
47+
uses: aws-actions/configure-aws-credentials@v6.0.0
4848
with:
4949
role-to-assume: arn:aws:iam::${{ inputs.idp_aws_report_upload_account_id }}:role/${{ inputs.idp_aws_report_upload_role_name }}
5050
aws-region: ${{ inputs.idp_aws_report_upload_region }}

.github/actions/scan-dependencies/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ runs:
5858
run: echo "secrets_exist=${{ inputs.idp_aws_report_upload_role_name != '' && inputs.idp_aws_report_upload_bucket_endpoint != '' }}" >> $GITHUB_OUTPUT
5959
- name: "Authenticate to send the reports"
6060
if: steps.check.outputs.secrets_exist == 'true'
61-
uses: aws-actions/configure-aws-credentials@v2
61+
uses: aws-actions/configure-aws-credentials@v6.0.0
6262
with:
6363
role-to-assume: arn:aws:iam::${{ inputs.idp_aws_report_upload_account_id }}:role/${{ inputs.idp_aws_report_upload_role_name }}
6464
aws-region: ${{ inputs.idp_aws_report_upload_region }}

.github/actions/service-automation-test/action.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ inputs:
1212
description: "AWS region"
1313
required: true
1414
test_tag:
15-
description: "feature tag that identifies tests to be run"
15+
description: "The name of the feature tag that identifies the tests to run"
1616
required: true
1717
test_type:
18-
description: "tag that identifies types of test and reports to be run"
18+
description: "The name of the type of test report that will be generated (e.g., bdd, apim, ui)"
1919
required: true
20+
api_name:
21+
description: "The name of the API to test (for APIM tests, e.g., dos-search)"
22+
required: false
23+
apim_env:
24+
description: "The APIM environment to test (for APIM tests, e.g., internal-dev, internal-qa)"
25+
required: false
2026
commit_hash:
2127
description: "The commit hash, set by the CI/CD pipeline workflow"
2228
required: false
@@ -38,6 +44,8 @@ runs:
3844
TEST_TYPE: ${{ inputs.test_type }}
3945
COMMIT_HASH: ${{ inputs.commit_hash }}
4046
REF: ${{ inputs.ref }}
47+
API_NAME: ${{ inputs.api_name }}
48+
APIM_ENV: ${{ inputs.apim_env }}
4149
run: |
4250
set -euo pipefail
4351
/bin/bash ./scripts/workflow/service-automation-tests.sh

.github/workflows/aws-wafr-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
# Assume steampipe-readonly-role using role chaining
7373
- name: Assume steampipe-readonly-role
7474
if: steps.should-run.outputs.should_run == 'true'
75-
uses: aws-actions/configure-aws-credentials@v5.1.1
75+
uses: aws-actions/configure-aws-credentials@v6.0.0
7676
with:
7777
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/${{ github.event.repository.name }}-steampipe-readonly-role
7878
role-chaining: true

.github/workflows/pipeline-deploy-application.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
with:
7676
environment: ${{ needs.metadata.outputs.environment }}
7777
workspace: ${{ needs.metadata.outputs.workspace }}
78-
ref: ${{ inputs.ref }}
78+
ref: ${{ inputs.ref }}
7979

8080
build-services:
8181
name: "Build ${{ matrix.name }}"
@@ -329,17 +329,22 @@ jobs:
329329
name: "Run ${{ matrix.tag }} service automation tests on ${{ needs.metadata.outputs.environment }}"
330330
strategy:
331331
fail-fast: false
332+
max-parallel: 1
332333
matrix:
333334
include:
334-
- tag: "ftrs-pipeline"
335-
type: "api"
335+
- tag: "integrated-search"
336+
type: "bdd"
337+
api_name: "dos-search"
336338
- tag: "data-migration"
337-
type: "data-migration"
339+
type: "bdd"
340+
- tag: "data-sourcing"
341+
type: "bdd"
338342
needs:
339343
- metadata
340344
- deploy-application-infrastructure
341345
- restore-dynamodb-from-s3
342346
- export-dynamodb-to-s3
347+
- deploy-proxy-to-apim
343348
if: |
344349
always() &&
345350
!cancelled() &&
@@ -358,6 +363,7 @@ jobs:
358363
ref: ${{ inputs.ref }}
359364
test_tag: ${{ matrix.tag }}
360365
test_type: ${{ matrix.type }}
366+
api_name: ${{ matrix.api_name || '' }}
361367
type: app
362368
deployment_type: "development"
363369
secrets: inherit

.github/workflows/service-automation-test.yaml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_call:
66
inputs:
77
environment:
8-
description: The relevant github environment (for secrets and variables)
8+
description: "The relevant github environment (for secrets and variables)"
99
required: true
1010
type: string
1111
workspace:
@@ -17,7 +17,15 @@ on:
1717
required: false
1818
type: string
1919
test_type:
20-
description: "The name of the type of test report that will be generated"
20+
description: "The name of the type of test report that will be generated (e.g., bdd, apim, ui)"
21+
required: false
22+
type: string
23+
api_name:
24+
description: "The name of the API to test (for APIM tests, e.g., dos-search)"
25+
required: false
26+
type: string
27+
apim_env:
28+
description: "The APIM environment to test (for APIM tests, e.g., internal-dev, internal-qa)"
2129
required: false
2230
type: string
2331
ref:
@@ -127,19 +135,21 @@ jobs:
127135
uses: actions/cache@v5
128136
with:
129137
path: ~/.asdf
130-
key: asdf-${{ runner.os }}-${{ hashFiles('.tool-versions') }}
138+
key: asdf-${{ runner.os }}-${{ hashFiles('.tool-versions', 'tests/service_automation/.tool-versions') }}
131139

132140
- name: "Install tools from .tool-versions"
133141
if: steps.asdf-cache.outputs.cache-hit != 'true'
134142
uses: asdf-vm/actions/install@v4.0.1
135143

136144
- name: "Cache Poetry dependencies"
145+
id: poetry-cache
137146
uses: actions/cache@v5
138147
with:
139148
path: ~/.cache/pypoetry
140149
key: ${{ runner.os }}-poetry-${{ hashFiles('tests/service_automation/poetry.lock') }}
141150

142151
- name: "Cache Playwright browsers"
152+
id: playwright-cache
143153
uses: actions/cache@v5
144154
with:
145155
path: ~/.cache/ms-playwright
@@ -154,9 +164,27 @@ jobs:
154164
environment: ${{ inputs.environment }}
155165

156166
- name: "Install project"
167+
if: steps.asdf-cache.outputs.cache-hit != 'true' || steps.poetry-cache.outputs.cache-hit != 'true' || steps.playwright-cache.outputs.cache-hit != 'true'
157168
run: make install
158169
working-directory: "tests/service_automation"
159170

171+
- name: Authenticate with APIM
172+
if: inputs.test_type == 'apim'
173+
uses: ./.github/actions/authenticate-apim
174+
id: apim-auth
175+
with:
176+
api_name: ${{ inputs.api_name }}
177+
environment: ${{ inputs.environment }}
178+
aws_region: ${{ vars.AWS_REGION }}
179+
180+
- name: Get Apigee access token
181+
if: inputs.test_type == 'apim'
182+
uses: ./.github/actions/authenticate-apim-pytest
183+
with:
184+
api_name: ${{ inputs.api_name }}
185+
access_token: ${{ steps.apim-auth.outputs.access_token }}
186+
proxygen_base_url: ${{ secrets.PROXYGEN_URL }}
187+
160188
- name: Run ${{ inputs.test_tag }} service automation tests
161189
id: run-service_automation-tests
162190
uses: ./.github/actions/service-automation-test
@@ -166,6 +194,8 @@ jobs:
166194
workspace: ${{ inputs.workspace }}
167195
test_tag: ${{ inputs.test_tag }}
168196
test_type: ${{ inputs.test_type }}
197+
api_name: ${{ inputs.api_name }}
198+
apim_env: ${{ inputs.environment == 'dev' && 'internal-dev' || inputs.environment == 'test' && 'internal-qa' || inputs.environment }}
169199
commit_hash: ${{ inputs.commit_hash || github.sha }}
170200
ref: ${{ inputs.ref }}
171201

docs/specification/dos-search.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,3 +631,15 @@ x-nhsd-apim:
631631
- name: application-name
632632
required: false
633633
header: application-name
634+
# Request a proxy-level cap of 150 TPS (9000/min) to limit aggregate traffic to the backend.
635+
# Note: proxy is a shared/global cap across all applications; no per-application default is requested here.
636+
ratelimiting:
637+
proxy:
638+
# 150 transactions per second -> 150 * 60 = 9,000 per minute
639+
timeunit: "minute"
640+
limit: 9000
641+
# Per-application (per-subscription / per-api-key) quota to ensure fair usage between clients.
642+
# 10 transactions per second -> 10 * 60 = 600 per minute per application
643+
app-default:
644+
timeunit: "minute"
645+
limit: 600

docs/user-guides/Test_GitHub_Actions_locally.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $ make runner-act workflow="stage-1-commit" job="create-lines-of-code-report"
4949
[Commit stage/Count lines of code] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1-composite-check.sh] user= workdir=
5050
[Commit stage/Count lines of code] ✅ Success - Main Check prerequisites for sending the report
5151
[Commit stage/Count lines of code] ⚙ ::set-output:: secrets_exist=false
52-
[Commit stage/Count lines of code] ☁ git clone 'https://github.com/aws-actions/configure-aws-credentials' # ref=v2
52+
[Commit stage/Count lines of code] ☁ git clone 'https://github.com/aws-actions/configure-aws-credentials' # ref=v6.0.0
5353
[Commit stage/Count lines of code] ✅ Success - Main Count lines of code
5454
[Commit stage/Count lines of code] ⚙ ::set-output:: secrets_exist=false
5555
[Commit stage/Count lines of code] ⭐ Run Post Count lines of code

0 commit comments

Comments
 (0)