CCM-14194: Nightly Builds#107
Closed
damientobin1 wants to merge 7 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the release-test runner to better support nightly builds across environments by centralising SSM parameter retrieval (with optional fallback) and making pytest defaults less invasive when variables are already provided.
Changes:
- Added helper functions in
scripts/run.shto fetch SSM parameters and allow environment-based fallback for release-test secrets. - Added sensible defaults for
API_ENVIRONMENT,BASE_URL, andCLIENTinscripts/run.shwhen not present in SSM. - Updated
conftest.pyso pytest only setsAPI_ENVIRONMENT/BASE_URL/CLIENTwhen they are not already supplied via the environment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/run.sh | Adds SSM lookup helpers, fallback secret resolution, and defaulting for nightly build execution. |
| conftest.py | Adjusts pytest session defaults to avoid overriding externally-supplied environment configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+15
to
+38
| get_release_test_secret() { | ||
| local secret_name="$1" | ||
| local primary_parameter="/comms/${ENVIRONMENT}/release-tests/${secret_name}" | ||
| local fallback_environment="${RELEASE_TESTS_CONFIG_FALLBACK_ENVIRONMENT:-uat}" | ||
| local fallback_parameter="/comms/${fallback_environment}/release-tests/${secret_name}" | ||
| local value | ||
|
|
||
| value=$(get_ssm_parameter_value "$primary_parameter") | ||
| if [ -n "$value" ] && [ "$value" != "None" ]; then | ||
| printf '%s' "$value" | ||
| return 0 | ||
| fi | ||
|
|
||
| if [ "$ENVIRONMENT" != "$fallback_environment" ]; then | ||
| value=$(get_ssm_parameter_value "$fallback_parameter") | ||
| if [ -n "$value" ] && [ "$value" != "None" ]; then | ||
| echo "Using fallback release test config from ${fallback_parameter}" >&2 | ||
| printf '%s' "$value" | ||
| return 0 | ||
| fi | ||
| fi | ||
|
|
||
| return 1 | ||
| } |
Comment on lines
+79
to
84
| PRIVATE_KEY_CONTENTS=$(get_release_test_secret "private-key") && export PRIVATE_KEY_CONTENTS | ||
| printf '%s' "$PRIVATE_KEY_CONTENTS" > ./private.key | ||
| export PRIVATE_KEY=./private.key | ||
| MESH_CLIENT_CONFIG_CONTENTS=$(aws ssm get-parameter --name "/comms/${ENVIRONMENT}/release-tests/mesh-client-config" --with-decryption --query "Parameter.Value" --output text) && export MESH_CLIENT_CONFIG_CONTENTS | ||
| echo $MESH_CLIENT_CONFIG_CONTENTS > ./client_config.json | ||
| MESH_CLIENT_CONFIG_CONTENTS=$(get_release_test_secret "mesh-client-config") && export MESH_CLIENT_CONFIG_CONTENTS | ||
| printf '%s' "$MESH_CLIENT_CONFIG_CONTENTS" > ./client_config.json | ||
| export MESH_CLIENT_CONFIG=./client_config.json |
Comment on lines
+70
to
+88
| environment = os.environ.get("ENVIRONMENT") | ||
|
|
||
| if "API_ENVIRONMENT" not in os.environ: | ||
| if environment == "int": | ||
| os.environ["API_ENVIRONMENT"] = "int" | ||
| else: | ||
| os.environ["API_ENVIRONMENT"] = "internal-qa" | ||
|
|
||
| if "BASE_URL" not in os.environ: | ||
| if environment == "int": | ||
| os.environ["BASE_URL"] = "https://int.api.service.nhs.uk/comms" | ||
| else: | ||
| os.environ["BASE_URL"] = "https://internal-qa.api.service.nhs.uk/comms" | ||
|
|
||
| if "CLIENT" not in os.environ: | ||
| if environment == "int": | ||
| os.environ["CLIENT"] = "apim_integration_test" | ||
| else: | ||
| os.environ["CLIENT"] = "apim_integration_test_client_id" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.