Skip to content

Commit 6efc8de

Browse files
alexghrspypsy
andauthored
fix: setup GCP secrets (#17716)
backport of #17711 Co-authored-by: alexghr <3816165+alexghr@users.noreply.github.com> Co-authored-by: spypsy <spypsy@outlook.com>
1 parent ea34ee6 commit 6efc8de

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

spartan/scripts/setup_gcp_secrets.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,25 @@ for env_var in "${!SECRET_MAPPINGS[@]}"; do
5555
if grep -q "^${env_var}=REPLACE_WITH_GCP_SECRET" "$ENV_FILE"; then
5656
# Export the secret value
5757
secret_value=$(get_secret "$secret_name")
58+
echo "::add-mask::$secret_value"
5859
export $env_var="${secret_value}"
5960
elif grep -q "^${env_var}=REPLACE_WITH_GCP_SECRET/" "$ENV_FILE"; then
6061
# Handle cases like STORE_SNAPSHOT_URL=REPLACE_WITH_GCP_SECRET/network/
6162
suffix=$(grep "^${env_var}=REPLACE_WITH_GCP_SECRET/" "$ENV_FILE" | cut -d'/' -f2-)
6263
secret_value=$(get_secret "$secret_name")
64+
echo "::add-mask::$secret_value"
6365
export $env_var='${secret_value}/'$suffix
66+
elif grep -q "^${env_var}=.*REPLACE_WITH_GCP_SECRET" "$ENV_FILE"; then
67+
# Replace inline occurrences within the value, preserving surrounding content
68+
full_value=$(grep "^${env_var}=" "$ENV_FILE" | cut -d'=' -f2-)
69+
# Strip surrounding double quotes if present
70+
if [[ "$full_value" == \"*\" && "$full_value" == *\" ]]; then
71+
full_value="${full_value:1:-1}"
72+
fi
73+
secret_value=$(get_secret "$secret_name")
74+
echo "::add-mask::$secret_value"
75+
replaced_value="${full_value//REPLACE_WITH_GCP_SECRET/$secret_value}"
76+
export $env_var="$replaced_value"
6477
fi
6578
done
6679

spartan/terraform/deploy-aztec-infra/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,4 @@ variable "RPC_INGRESS_SSL_CERT_NAME" {
446446
type = string
447447
default = ""
448448
}
449+

spartan/terraform/deploy-rollup-contracts/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ variable "AZTEC_DOCKER_IMAGE" {
1818
variable "L1_RPC_URLS" {
1919
description = "Comma-separated list of L1 RPC URLs"
2020
type = string
21+
sensitive = true
2122
}
2223

2324
variable "PRIVATE_KEY" {

0 commit comments

Comments
 (0)