Skip to content

CCM-14194: Nightly Builds#107

Closed
damientobin1 wants to merge 7 commits into
mainfrom
feature/CCM-14194_nightly_builds
Closed

CCM-14194: Nightly Builds#107
damientobin1 wants to merge 7 commits into
mainfrom
feature/CCM-14194_nightly_builds

Conversation

@damientobin1

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to fetch SSM parameters and allow environment-based fallback for release-test secrets.
  • Added sensible defaults for API_ENVIRONMENT, BASE_URL, and CLIENT in scripts/run.sh when not present in SSM.
  • Updated conftest.py so pytest only sets API_ENVIRONMENT/BASE_URL/CLIENT when 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 thread scripts/run.sh
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 thread scripts/run.sh
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 thread conftest.py
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants