Skip to content

Commit 55095bc

Browse files
committed
azure-set-vars: retry var group creation better
Retry a few times in a loop. If we still don't have the group ID by the end, exit with an error. Signed-off-by: Adam Cmiel <[email protected]>
1 parent 3e6ad6a commit 55095bc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

hack/_azure-set-vars.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ get_or_create_vargroup() {
4646
echo "$group_id"
4747
}
4848

49-
VARGROUP_ID=$(get_or_create_vargroup "$AZURE_VARIABLE_GROUP_NAME")
50-
if [[ -z $VARGROUP_ID ]]; then
51-
echo "Variable group creation sometimes fails despite succeeding, trying again..." >&2
49+
for _ in {1..3}; do
5250
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
5361
fi
5462

5563
set_var() {

0 commit comments

Comments
 (0)