Skip to content

Commit 6eb0771

Browse files
committed
add retry to cfnlint update
1 parent e4c84e3 commit 6eb0771

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

bin/run_cfn_lint.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ if [ ! -d "${VENV}" ]; then
1010
fi
1111

1212
"${VENV}/bin/python" -m pip install cfn-lint --upgrade --quiet
13-
# update cfn schema
14-
"${VENV}/bin/cfn-lint" -u
13+
# update cfn schema with retry logic (can fail due to network issues)
14+
MAX_RETRIES=3
15+
RETRY_COUNT=0
16+
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
17+
if "${VENV}/bin/cfn-lint" -u; then
18+
echo "Successfully updated cfn-lint schema"
19+
break
20+
else
21+
RETRY_COUNT=$((RETRY_COUNT + 1))
22+
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
23+
echo "cfn-lint schema update failed, retrying... (attempt $RETRY_COUNT of $MAX_RETRIES)"
24+
sleep 2
25+
else
26+
echo "cfn-lint schema update failed after $MAX_RETRIES attempts"
27+
exit 1
28+
fi
29+
fi
30+
done
1531
"${VENV}/bin/cfn-lint" --format parseable

0 commit comments

Comments
 (0)