File tree Expand file tree Collapse file tree 3 files changed +33
-9
lines changed
Expand file tree Collapse file tree 3 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,6 @@ set -o errexit
1717set -o nounset
1818set -o pipefail
1919
20- # for Prow we use the provided AZURE_CREDENTIALS file
21- 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-) "
27- fi
28-
2920# Verify the required Environment Variables are present.
3021: " ${AZURE_SUBSCRIPTION_ID:? Environment variable empty or not defined.} "
3122: " ${AZURE_TENANT_ID:? Environment variable empty or not defined.} "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Copyright 2020 The Kubernetes Authors.
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
16+ set -o errexit
17+ set -o nounset
18+ set -o pipefail
19+
20+ parse_cred () {
21+ grep -E -o " $1 [[:blank:]]*=[[:blank:]]*\" [^[:space:]\" ]+\" " | cut -d ' "' -f 2
22+ }
23+
24+ # for Prow we use the provided AZURE_CREDENTIALS file.
25+ # the file is expected to be in toml format.
26+ if [[ -n " ${AZURE_CREDENTIALS:- } " ]]; then
27+ export AZURE_SUBSCRIPTION_ID=" $( cat ${AZURE_CREDENTIALS} | parse_cred SubscriptionID) "
28+ export AZURE_TENANT_ID=" $( cat ${AZURE_CREDENTIALS} | parse_cred TenantID) "
29+ export AZURE_CLIENT_ID=" $( cat ${AZURE_CREDENTIALS} | parse_cred ClientID) "
30+ export AZURE_CLIENT_SECRET=" $( cat ${AZURE_CREDENTIALS} | parse_cred ClientSecret) "
31+ fi
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ source "${REPO_ROOT}/hack/ensure-kind.sh"
3333source " ${REPO_ROOT} /hack/ensure-kubectl.sh"
3434# shellcheck source=../hack/ensure-kustomize.sh
3535source " ${REPO_ROOT} /hack/ensure-kustomize.sh"
36+ # shellcheck source=../hack/parse-prow-creds.sh
37+ source " ${REPO_ROOT} /hack/parse-prow-creds.sh"
3638
3739random-string () {
3840 cat /dev/urandom | tr -dc ' a-zA-Z0-9' | fold -w ${1:- 32} | head -n 1
You can’t perform that action at this time.
0 commit comments