Skip to content

Commit f172954

Browse files
authored
Merge pull request #131 from chmeliik/azure-followups
Azure variables: follow-ups for review comments
2 parents 069dd2f + 55095bc commit f172954

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

hack/_azure-set-vars.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
#!/bin/bash
22
set -o errexit -o pipefail
33

4-
: "${AZURE_DEVOPS_EXT_PAT:?}"
4+
# Create a variable group called $AZURE_VARIABLE_GROUP_NAME (if it doesn't exist)
5+
# and set all the variables needed for the RHTAP pipeline.
6+
#
7+
# If you have the Azure CLI (az) installed and don't mind running the commands
8+
# in this script on your machine, you can execute this script directly. Otherwise,
9+
# run this in a container via hack/azure-set-vars.sh
10+
#
11+
# Before running this script, source your .env or .envrc file.
12+
13+
: "${AZURE_DEVOPS_EXT_PAT:?}" # the 'az' commands use this variable automatically
514
: "${AZURE_VARIABLE_GROUP_NAME:?}"
615
: "${AZURE_ORGANIZATION:?}"
716
: "${AZURE_PROJECT:?}"
@@ -37,10 +46,18 @@ get_or_create_vargroup() {
3746
echo "$group_id"
3847
}
3948

40-
VARGROUP_ID=$(get_or_create_vargroup "$AZURE_VARIABLE_GROUP_NAME")
41-
if [[ -z $VARGROUP_ID ]]; then
42-
echo "Variable group creation sometimes fails despite succeeding, trying again..." >&2
49+
for _ in {1..3}; do
4350
VARGROUP_ID=$(get_or_create_vargroup "$AZURE_VARIABLE_GROUP_NAME")
51+
if [[ -n $VARGROUP_ID ]]; then
52+
break
53+
fi
54+
55+
echo "Variable group creation sometimes fails despite succeeding, trying again..." >&2
56+
done
57+
58+
if [[ -z $VARGROUP_ID ]]; then
59+
echo "Failed to get the variable group ID" >&2
60+
exit 1
4461
fi
4562

4663
set_var() {

hack/azure-set-vars.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22
set -o errexit -o nounset -o pipefail
33

4+
# Run a script in the azure-cli container to set Azure variables.
5+
# See the header in hack/_azure-set-vars.sh for more details.
6+
47
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
58

69
# Find available versions with

0 commit comments

Comments
 (0)