-
Notifications
You must be signed in to change notification settings - Fork 1
Chore: [AEA-6593] - move to new exports #3025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -123,7 +123,7 @@ echo | |||||||||||||
| echo "Retrieving proxygen credentials" | ||||||||||||||
|
|
||||||||||||||
| # Retrieve the proxygen private key and client private key and cert from AWS Secrets Manager | ||||||||||||||
| proxygen_private_key_arn=$(aws cloudformation list-exports --query "Exports[?Name=='account-resources:${PROXYGEN_PRIVATE_KEY_NAME}'].Value" --output text) | ||||||||||||||
| proxygen_private_key_arn=$(aws cloudformation list-exports --query "Exports[?Name=='secrets-cdk:Secrets:${PROXYGEN_PRIVATE_KEY_NAME}:Arn'].Value" --output text) | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| if [[ -z "${proxygen_private_key_arn}" || "${proxygen_private_key_arn}" == "None" ]]; then | |
| echo "Error: Could not resolve CloudFormation export 'secrets-cdk:Secrets:${PROXYGEN_PRIVATE_KEY_NAME}:Arn' for PROXYGEN_PRIVATE_KEY_NAME='${PROXYGEN_PRIVATE_KEY_NAME}'." >&2 | |
| exit 1 | |
| fi |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,25 +6,26 @@ export AWS_MAX_ATTEMPTS | |||||||||||||||||||||||||||||
| echo "$COMMIT_ID" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| CF_LONDON_EXPORTS=$(aws cloudformation list-exports --region eu-west-2 --output json) | ||||||||||||||||||||||||||||||
| artifact_bucket_arn=$(echo "$CF_LONDON_EXPORTS" | \ | ||||||||||||||||||||||||||||||
| jq \ | ||||||||||||||||||||||||||||||
| --arg EXPORT_NAME "account-resources:ArtifactsBucket" \ | ||||||||||||||||||||||||||||||
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | ||||||||||||||||||||||||||||||
| artifact_bucket=$(echo "$artifact_bucket_arn" | cut -d: -f6 | cut -d/ -f1) | ||||||||||||||||||||||||||||||
| artifact_bucket=$(echo "$CF_LONDON_EXPORTS" | \ | ||||||||||||||||||||||||||||||
| jq \ | ||||||||||||||||||||||||||||||
| --arg EXPORT_NAME "account-resources-cdk-uk:Bucket:ArtifactsBucket:Arn" \ | ||||||||||||||||||||||||||||||
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| artifact_bucket=$(echo "$CF_LONDON_EXPORTS" | \ | |
| jq \ | |
| --arg EXPORT_NAME "account-resources-cdk-uk:Bucket:ArtifactsBucket:Arn" \ | |
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | |
| ARTIFACT_BUCKET_ARN=$(echo "$CF_LONDON_EXPORTS" | \ | |
| jq \ | |
| --arg EXPORT_NAME "account-resources-cdk-uk:Bucket:ArtifactsBucket:Arn" \ | |
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | |
| artifact_bucket=$(echo "${ARTIFACT_BUCKET_ARN}" | cut -d ":" -f 6) | |
| if [ -z "${artifact_bucket}" ]; then | |
| echo "could not retrieve artifact bucket name from aws cloudformation list-exports" | |
| exit 1 | |
| fi |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -247,8 +247,15 @@ jobs: | |||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| mkdir -p ~/.proxygen/tmp | ||||||||||||||||||||||
| client_private_key_arn=$(aws cloudformation list-exports --query "Exports[?Name=='account-resources:PsuClientKeySecret'].Value" --output text) | ||||||||||||||||||||||
| client_cert_arn=$(aws cloudformation list-exports --query "Exports[?Name=='account-resources:PsuClientCertSecret'].Value" --output text) | ||||||||||||||||||||||
| CF_LONDON_EXPORTS=$(aws cloudformation list-exports --region eu-west-2 --output json) | ||||||||||||||||||||||
| client_private_key_arn=$(echo "$CF_LONDON_EXPORTS" | \ | ||||||||||||||||||||||
| jq \ | ||||||||||||||||||||||
| --arg EXPORT_NAME "secrets-cdk:Secrets:PsuClientKeySecret:Arn" \ | ||||||||||||||||||||||
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | ||||||||||||||||||||||
| client_cert_arn=$(echo "$CF_LONDON_EXPORTS" | \ | ||||||||||||||||||||||
| jq \ | ||||||||||||||||||||||
| --arg EXPORT_NAME "secrets-cdk:Secrets:PsuClientCertSecret:Arn" \ | ||||||||||||||||||||||
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | ||||||||||||||||||||||
|
||||||||||||||||||||||
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | |
| -r '.Exports[] | select(.Name == $EXPORT_NAME) | .Value') | |
| if [[ -z "${client_private_key_arn}" ]]; then | |
| echo "Error: required CloudFormation export 'secrets-cdk:Secrets:PsuClientKeySecret:Arn' was not found in eu-west-2." >&2 | |
| exit 1 | |
| fi | |
| if [[ -z "${client_cert_arn}" ]]; then | |
| echo "Error: required CloudFormation export 'secrets-cdk:Secrets:PsuClientCertSecret:Arn' was not found in eu-west-2." >&2 | |
| exit 1 | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the CloudFormation export isn’t present, this
list-exportsquery will return an empty string and the subsequent Lambda payloads will be built with an invalidproxygenSecretName. Add a check after this assignment to ensureproxygen_private_key_arnis non-empty and exit with a clear error if it can’t be resolved.