Skip to content

Commit 2dc8a23

Browse files
Merge branch 'master' into dependabot/npm_and_yarn/tough-cookie-4.1.3
2 parents 38ce1c3 + 949461e commit 2dc8a23

18 files changed

Lines changed: 13039 additions & 3164 deletions

.github/workflows/continuous-integration.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ jobs:
88
if: github.ref == 'refs/heads/master'
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v4
1212
with:
13-
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
13+
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
1414

15-
- name: Install Python 3.8
16-
uses: actions/setup-python@v1
15+
- name: Install Python 3.10
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.8
18+
python-version: "3.10"
1919

2020
- name: Upgrade python pip
21-
run: python -m pip install --upgrade pip
21+
run: python -m pip install --upgrade pip
2222

2323
- name: Install git
2424
run: pip install gitpython
@@ -41,4 +41,3 @@ jobs:
4141
with:
4242
tag_name: ${{ env.SPEC_VERSION }}
4343
release_name: ${{ env.SPEC_VERSION }}
44-

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SHELL=/bin/bash -euo pipefail
22

33
#Installs dependencies using poetry.
44
install-python:
5-
poetry install
5+
poetry install --no-root
66

77
#Installs dependencies using npm.
88
install-node:

azure/azure-release-pipeline.yml

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,18 @@ extends:
3030
service_name: ${{ variables.service_name }}
3131
short_service_name: ${{ variables.short_service_name }}
3232
service_base_path: ${{ variables.service_base_path }}
33+
prod_producer_approval: true
3334
apigee_deployments:
3435
- environment: internal-dev
3536
post_deploy:
3637
- template: ./templates/run-tests.yml
3738
parameters:
3839
full: true
39-
# - environment: internal-dev-sandbox
40-
# proxy_path: sandbox
41-
# post_deploy:
42-
# - template: ./templates/run-tests.yml
43-
# - environment: internal-qa
44-
# post_deploy:
45-
# - template: ./templates/run-tests.yml
46-
# parameters:
47-
# full: true
48-
# - environment: internal-qa-sandbox
49-
# proxy_path: sandbox
50-
# post_deploy:
51-
# - template: ./templates/run-tests.yml
52-
# - environment: ref
53-
# depends_on:
54-
# - internal_qa
55-
# - internal_qa_sandbox
56-
# post_deploy:
57-
# - template: ./templates/run-tests.yml
58-
# - environment: sandbox
59-
# proxy_path: sandbox
60-
# post_deploy:
61-
# - template: ./templates/run-tests.yml
62-
# # Enable int environment when ready by uncommenting:
63-
# - environment: int
64-
# depends_on:
65-
# - internal_qa
66-
# - internal_qa_sandbox
67-
# post_deploy:
68-
# - template: ./templates/run-tests.yml
69-
# parameters:
70-
# full: true
71-
# test-command: prod
72-
# smoketest-command: prod
40+
- environment: int
41+
depends_on:
42+
- internal_dev
43+
post_deploy:
44+
- template: ./templates/run-tests.yml
45+
- environment: prod
46+
depends_on:
47+
- int

azure/templates/run-tests.yml

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,42 @@
1-
parameters:
2-
- name: full
3-
type: boolean
4-
default: false
5-
- name: test_command
6-
type: string
7-
default: 'make test'
8-
- name: smoketest_command
9-
type: string
10-
default: 'make smoketest'
11-
121
steps:
132
- bash: |
143
make install-python
154
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
165
displayName: Setup pytests
17-
condition: always()
186
19-
- ${{ if parameters.full }}:
20-
# In order to run tests in prod you must supply the unique ID of an Apigee app
21-
# that has authorized access to your service proxy.
22-
- bash: |
23-
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
24-
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
25-
export APIGEE_APP_ID="MY APP ID"
26-
export STATUS_ENDPOINT_API_KEY="$(STATUS_ENDPOINT_API_KEY)"
27-
export SOURCE_COMMIT_ID="$(Build.SourceVersion)"
28-
${{ parameters.test_command }}
29-
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
30-
displayName: Run full test suite
31-
- task: PublishTestResults@2
32-
displayName: 'Publish test results'
33-
condition: always()
34-
inputs:
35-
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/test-report.xml'
36-
failTaskOnFailedTests: true
37-
- ${{ if not(parameters.full) }}:
38-
# In order to run tests in prod you must supply the unique ID of an Apigee app
39-
# that has authorized access to your service proxy.
40-
- bash: |
41-
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
42-
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
43-
export APIGEE_APP_ID="MY APP ID"
44-
export STATUS_ENDPOINT_API_KEY="$(STATUS_ENDPOINT_API_KEY)"
45-
export SOURCE_COMMIT_ID="$(Build.SourceVersion)"
46-
${{ parameters.smoketest_command }}
47-
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
48-
displayName: Run smoketests
49-
- task: PublishTestResults@2
50-
displayName: 'Publish smoketest results'
51-
condition: always()
52-
inputs:
53-
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/smoketest-report.xml'
54-
failTaskOnFailedTests: true
7+
- template: "azure/components/aws-assume-role.yml@common"
8+
parameters:
9+
role: "auto-ops"
10+
profile: "apm_ptl"
11+
12+
- template: "azure/components/get-aws-secrets-and-ssm-params.yml@common"
13+
parameters:
14+
secret_file_ids:
15+
- ptl/app-credentials/jwt_testing/non-prod/JWT_TESTING_PRIVATE_KEY
16+
- ptl/app-credentials/jwt_testing/non-prod/ID_TOKEN_NHS_LOGIN_PRIVATE_KEY
17+
18+
- bash: |
19+
export RELEASE_RELEASEID=$(Build.BuildId)
20+
export SOURCE_COMMIT_ID=$(Build.SourceVersion)
21+
export APIGEE_ENVIRONMENT="$(ENVIRONMENT)"
22+
export SERVICE_BASE_PATH="$(SERVICE_BASE_PATH)"
23+
export STATUS_ENDPOINT_API_KEY="$(status-endpoint-api-key)"
24+
export ID_TOKEN_NHS_LOGIN_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(ID_TOKEN_NHS_LOGIN_PRIVATE_KEY)"
25+
export JWT_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(JWT_TESTING_PRIVATE_KEY)"
26+
export APIGEE_API_TOKEN="$(secret.AccessToken)"
27+
28+
if [[ $APIGEE_ENVIRONMENT == "internal-dev" ]]
29+
then
30+
poetry run pytest -v -s
31+
else
32+
make smoketest
33+
fi
34+
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
35+
displayName: run tests
36+
37+
- task: PublishTestResults@2
38+
displayName: 'Publish smoketest results'
39+
condition: always()
40+
inputs:
41+
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/smoketest-report.xml'
42+
failTaskOnFailedTests: true

manifest_template.yml

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,16 @@ DESCRIPTION: example description
44
APIGEE_ENVIRONMENTS:
55
- name: internal-dev
66
display_name: Internal Development
7-
has_mock_auth: true
8-
- name: internal-qa
9-
display_name: Internal QA
10-
has_mock_auth: true
117
- name: ref
128
display_name: Reference
139
has_mock_auth: true
14-
# Enable environments when ready by uncommenting:
15-
# - name: internal-dev-sandbox
16-
# display_name: Internal Development Sandbox
17-
# portal_visibility: false
18-
# - name: internal-qa
19-
# display_name: Internal QA
20-
# has_mock_auth: true
21-
# portal_visibility: false
22-
# - name: internal-qa-sandbox
23-
# display_name: Internal QA Sandbox
24-
# portal_visibility: false
25-
# - name: sandbox
26-
# display_name: Sandbox
27-
# portal_visibility: false
28-
# - name: int
29-
# display_name: Integration Testing
10+
- name: int
11+
display_name: Integration Testing
12+
has_mock_auth: true
13+
- name: prod
14+
display_name: Production
15+
has_mock_auth: false
16+
approval_type: manual
3017
---
3118
meta:
3219
api:
@@ -52,19 +39,19 @@ apigee:
5239
- name: ratelimiting
5340
value:
5441
{{ NAME }}:
42+
quota:
43+
enabled: false
44+
spikeArrest:
45+
enabled: false
46+
app:
5547
quota:
5648
enabled: true
57-
limit: 300
49+
limit: 30000 # 500 requests per second
5850
interval: 1
5951
timeunit: minute
6052
spikeArrest:
6153
enabled: true
62-
ratelimit: 600pm # 10 requests per second
63-
app:
64-
quota:
65-
enabled: false
66-
spikeArrest:
67-
enabled: false
54+
ratelimit: 60000pm # 1000 requests per second
6855
description: {{ DESCRIPTION }}
6956
displayName: {{ TITLE }}
7057
environments: [ {{ ENV.name }} ]
@@ -77,6 +64,7 @@ apigee:
7764
scopes:
7865
- 'urn:nhsd:apim:app:level3:{{ SERVICE_NAME }}'
7966
- 'urn:nhsd:apim:user-nhs-cis2:aal3:{{ SERVICE_NAME }}'
67+
- 'urn:nhsd:apim:user-nhs-login:P9:{{ SERVICE_NAME }}'
8068
specs:
8169
- name: {{ NAME }}
8270
path: {{ SERVICE_NAME }}.json
@@ -88,4 +76,4 @@ apigee:
8876
title: {{ TITLE }}
8977
visibility: {{ ENV.portal_visibility | default(true) }}
9078
specId: {{ NAME }}
91-
{% endfor %}
79+
{% endfor %}

0 commit comments

Comments
 (0)