Skip to content

Commit 254a412

Browse files
authored
Merge pull request #19 from NHSDigital/AMB-1682-Create-sandbox-with-prism
AMB-1682-Create-sandbox-with-prism
2 parents 8c32d7b + 2ab0e95 commit 254a412

37 files changed

+833
-241
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ smoketest-report.xml
1919
env
2020
.dir-locals.el
2121
*.pyc
22-
.python-version
22+
.python-version
23+
sandbox/specification/

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ clean:
2828
publish: clean
2929
mkdir -p build
3030
npm run publish 2> /dev/null
31+
cp build/immunisation-fhir-api.json sandbox/
32+
cp -r specification sandbox/specification
3133

3234
#Runs build proxy script
3335
build-proxy:
3436
scripts/build_proxy.sh
3537

3638
#Files to loop over in release
37-
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
39+
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests specification sandbox"
3840

3941
#Create /dist/ sub-directory and copy files into directory
4042
release: clean publish build-proxy

azure/azure-build-pipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ extends:
3030
parameters:
3131
service_name: ${{ variables.service_name }}
3232
short_service_name: ${{ variables.short_service_name }}
33+
post_ecs_push:
34+
- template: ./templates/build-sandbox-image.yml

azure/azure-pr-pipeline.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ extends:
3535
apigee_deployments:
3636
- environment: internal-dev
3737
post_deploy:
38-
- template: ./templates/run-tests.yml
39-
parameters:
40-
full: true
38+
- template: ./templates/post-deploy.yml
4139
- environment: internal-dev-sandbox
4240
proxy_path: sandbox
4341
post_deploy:
44-
- template: ./templates/run-tests.yml
42+
- template: ./templates/post-deploy.yml

azure/azure-release-pipeline.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,18 @@ extends:
3333
apigee_deployments:
3434
- environment: internal-dev
3535
post_deploy:
36-
- template: ./templates/run-tests.yml
37-
parameters:
38-
full: true
36+
- template: ./templates/post-deploy.yml
3937
- environment: internal-dev-sandbox
4038
proxy_path: sandbox
4139
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
40+
- template: ./templates/post-deploy.yml
5841
- environment: sandbox
5942
proxy_path: sandbox
43+
depends_on:
44+
- internal_dev_sandbox
6045
# # Enable int environment when ready by uncommenting:
6146
# - environment: int
6247
# depends_on:
63-
# - internal_qa
64-
# - internal_qa_sandbox
48+
# - internal_dev
6549
# post_deploy:
66-
# - template: ./templates/run-tests.yml
67-
# parameters:
68-
# full: true
69-
# test-command: prod
70-
# smoketest-command: prod
50+
# - template: ./templates/post-deploy.yml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
steps:
2+
- bash: |
3+
mkdir -p build
4+
npm run publish 2> /dev/null
5+
cp build/immunisation-fhir-api.json sandbox/
6+
7+
cd sandbox
8+
docker build -t sandbox .
9+
displayName: Build sandbox image
10+
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)"

azure/templates/post-deploy.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
parameters:
2+
- name: aws_dev
3+
default: aws --profile=apim-dev
4+
- name: is_ptl
5+
default: true
6+
7+
steps:
8+
- ${{ if parameters.is_ptl }}:
9+
- template: "azure/components/aws-assume-role.yml@common"
10+
parameters:
11+
role: "auto-ops"
12+
profile: "apm_ptl"
13+
14+
- bash: |
15+
make install-python
16+
17+
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
18+
displayName: Setup pytests
19+
condition: always()
20+
21+
- bash: |
22+
set -e
23+
export RELEASE_RELEASEID=$(Build.BuildId)
24+
export SOURCE_COMMIT_ID=$(Build.SourceVersion)
25+
export APIGEE_ENVIRONMENT="$(ENVIRONMENT)"
26+
export SERVICE_BASE_PATH="$(SERVICE_BASE_PATH)"
27+
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
28+
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
29+
export STATUS_ENDPOINT_API_KEY="$(status-endpoint-api-key)"
30+
31+
if [[ $APIGEE_ENVIRONMENT =~ .*-*sandbox ]]
32+
then
33+
poetry run pytest -v -m "not nhsd_apim_authorization and not sandbox_int" --api-name=immunisation-fhir-api --proxy-name=$PROXY_NAME -o junit_logging=all --junitxml=test-report.xml
34+
35+
elif [[ $APIGEE_ENVIRONMENT == "int" ]]
36+
then
37+
echo "Int tests to be set as of now"
38+
39+
else
40+
poetry run pytest -v -m "not sandbox_int" --api-name=immunisation-fhir-api --proxy-name=$PROXY_NAME -o junit_logging=all --junitxml=test-report.xml
41+
fi
42+
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/tests"
43+
displayName: Run full test suite
44+
45+
- task: PublishTestResults@2
46+
displayName: 'Publish test results'
47+
condition: always()
48+
inputs:
49+
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/tests/test-report.xml'
50+
failTaskOnFailedTests: true

ecs-proxies-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ docker_service:
1212
value: "{{ SERVICE_BASE_PATH }}"
1313
health_check:
1414
matcher: "200"
15-
path: "/_ping"
15+
path: "/_status"

0 commit comments

Comments
 (0)