Skip to content

Commit c580dcb

Browse files
author
Cecile Robert-Michon
committed
Change prow creds parsing to allow no new lines
1 parent 47ebb3a commit c580dcb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hack/create-dev-cluster.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ set -o errexit
1717
set -o nounset
1818
set -o pipefail
1919

20-
# for Prow we use the provided AZURE_CREDENTIALS file
20+
# for Prow we use the provided AZURE_CREDENTIALS file.
21+
# the file is expected to be in toml format.
2122
if [[ -n "${AZURE_CREDENTIALS:-}" ]]; then
22-
export AZURE_SUBSCRIPTION_ID="$(cat ${AZURE_CREDENTIALS} | grep SubscriptionID | cut -d '=' -f 2)"
23-
export AZURE_TENANT_ID="$(cat ${AZURE_CREDENTIALS} | grep TenantID | cut -d '=' -f 2)"
24-
export AZURE_CLIENT_ID="$(cat ${AZURE_CREDENTIALS} | grep ClientID | cut -d '=' -f 2)"
25-
# password might contain an '=' sign so we need to get all the fields after the first '='
26-
export AZURE_CLIENT_SECRET="$(cat ${AZURE_CREDENTIALS} | grep ClientSecret | cut -d '=' -f 2-)"
23+
export AZURE_SUBSCRIPTION_ID="$(cat ${AZURE_CREDENTIALS} | grep -E -o 'SubscriptionID[[:blank:]]*=[[:blank:]]*"[^[:space:]"]+"' | cut -d '"' -f 2)"
24+
export AZURE_TENANT_ID="$(cat ${AZURE_CREDENTIALS} | grep -E -o 'TenantID[[:blank:]]*=[[:blank:]]*"[^[:space:]"]+"' | cut -d '"' -f 2)"
25+
export AZURE_CLIENT_ID="$(cat ${AZURE_CREDENTIALS} | grep -E -o 'ClientID[[:blank:]]*=[[:blank:]]*"[^[:space:]"]+"' | cut -d '"' -f 2)"
26+
export AZURE_CLIENT_SECRET="$(cat ${AZURE_CREDENTIALS} | grep -E -o 'ClientSecret[[:blank:]]*=[[:blank:]]*"[^[:space:]"]+"' | cut -d '"' -f 2)"
2727
fi
2828

2929
# Verify the required Environment Variables are present.

0 commit comments

Comments
 (0)