Skip to content

Commit

Permalink
EM-1514 Tidy up release config
Browse files Browse the repository at this point in the history
  • Loading branch information
acarriedev committed Dec 11, 2024
1 parent 89d65eb commit bb86973
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 65 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ TEST_CMD := @APIGEE_ACCESS_TOKEN=$(APIGEE_ACCESS_TOKEN) \
PROD_TEST_CMD := $(TEST_CMD) \
--apigee-app-id=$(APIGEE_APP_ID) \
--apigee-organization=nhsd-prod \
--status-endpoint-api-key=$(STATUS_ENDPOINT_API_KEY) \
-k "test_wait_for_status"
--status-endpoint-api-key=$(STATUS_ENDPOINT_API_KEY)
-s

#Command to run end-to-end smoketests post-deployment to verify the environment is working
smoketest:
Expand Down
5 changes: 2 additions & 3 deletions azure/azure-pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ extends:
- environment: internal-dev
post_deploy:
- template: ./templates/run-tests.yml
parameters:
app_id: "73ee66da-247c-49be-8822-d23aaf4823ec"
full: true
- environment: internal-dev-sandbox
proxy_path: sandbox
post_deploy:
- template: ./templates/run-tests.yml
parameters:
test_command: make smoketest
17 changes: 8 additions & 9 deletions azure/azure-release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,32 @@ extends:
- environment: internal-dev
post_deploy:
- template: ./templates/run-tests.yml
parameters:
full: true
- environment: internal-dev-sandbox
proxy_path: sandbox
post_deploy:
- template: ./templates/run-tests.yml
- environment: internal-qa
- environment: internal-qa-sandbox
proxy_path: sandbox
parameters:
test_command: make smoketest
- environment: ref
post_deploy:
- template: ./templates/run-tests.yml
- environment: sandbox
proxy_path: sandbox
post_deploy:
- template: ./templates/run-tests.yml
parameters:
test_command: make smoketest
- environment: int
post_deploy:
- template: ./templates/run-tests.yml
parameters:
app_id: "0d334714-4548-4cf7-8b7f-ac194f341bc6"
full: true
test_command: make test-prod
test_command: make smoketest-prod
- environment: prod
depends_on:
- int
post_deploy:
- template: ./templates/run-tests.yml
parameters:
app_id: "0d334714-4548-4cf7-8b7f-ac194f341bc6"
full: true
test_command: make test-prod
test_command: make smoketest-prod
59 changes: 16 additions & 43 deletions azure/templates/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@ parameters:
- name: app_id
type: string
default: ""
- name: full
type: boolean
default: false
- name: test_command
type: string
default: 'make test'
- name: smoketest_command
type: string
default: 'make smoketest'
default: make test

steps:
- bash: |
Expand All @@ -19,39 +13,18 @@ steps:
displayName: Setup pytests
condition: always()
- ${{ if parameters.full }}:
# In order to run tests in prod you must supply the unique ID of an Apigee app
# that has authorized access to your service proxy.
- bash: |
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
export APIGEE_APP_ID=${{ parameters.app_id }}
export STATUS_ENDPOINT_API_KEY="$(STATUS_ENDPOINT_API_KEY)"
export SOURCE_COMMIT_ID="$(Build.SourceVersion)"
${{ parameters.test_command }}
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
displayName: Run full test suite
- task: PublishTestResults@2
displayName: 'Publish test results'
condition: always()
inputs:
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/test-report.xml'
failTaskOnFailedTests: true
- ${{ if not(parameters.full) }}:
# In order to run tests in prod you must supply the unique ID of an Apigee app
# that has authorized access to your service proxy.
- bash: |
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
export APIGEE_APP_ID=${{ parameters.app_id }}
export STATUS_ENDPOINT_API_KEY="$(STATUS_ENDPOINT_API_KEY)"
export SOURCE_COMMIT_ID="$(Build.SourceVersion)"
${{ parameters.smoketest_command }}
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
displayName: Run smoketests
- task: PublishTestResults@2
displayName: 'Publish smoketest results'
condition: always()
inputs:
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/smoketest-report.xml'
failTaskOnFailedTests: true
- bash: |
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
export APIGEE_APP_ID=${{ parameters.app_id }}
export STATUS_ENDPOINT_API_KEY="$(STATUS_ENDPOINT_API_KEY)"
export SOURCE_COMMIT_ID="$(Build.SourceVersion)"
${{ parameters.test_command }}
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
displayName: Run full test suite
- task: PublishTestResults@2
displayName: 'Publish test results'
condition: always()
inputs:
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/test-report.xml'
failTaskOnFailedTests: true
9 changes: 2 additions & 7 deletions manifest_template.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
SERVICE_NAME: multicast-notification-service
PRODUCT_DISPLAY_NAME: multicast-notification-service
DESCRIPTION: The multicast notification service
PRODUCT_DISPLAY_NAME: Multicast Notification Service API
DESCRIPTION: Publish and receive patient-related state changes from a single centralised system
APIGEE_ENVIRONMENTS:
- name: internal-dev
display_name: Internal Development
has_mock_auth: true
- name: internal-dev-sandbox
display_name: Internal Development Sandbox
- name: internal-qa
display_name: Internal QA
has_mock_auth: true
- name: ref
display_name: Reference
has_mock_auth: true
- name: internal-qa-sandbox
display_name: Internal QA Sandbox
- name: sandbox
display_name: Sandbox
has_mock_auth: true
Expand Down
2 changes: 1 addition & 1 deletion tests/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_missing_required_target_attributes(

update_response = requests.put(
f"{apigee_update_url}",
json=attributes_to_update,
json={"attributes": attributes_to_update},
headers={"Authorization": f"Bearer {os.environ['APIGEE_ACCESS_TOKEN']}"}
)
update_response.raise_for_status()
Expand Down

0 comments on commit bb86973

Please sign in to comment.