fix: retry version resolution

This commit is contained in:
bstein 2025-12-18 02:11:07 -03:00
parent acebc81af1
commit 23b4261424

19
Jenkinsfile vendored
View File

@ -99,11 +99,20 @@ spec:
echo "${HARBOR_VERSION}"
exit 0
fi
curl -sSL https://api.github.com/repos/goharbor/harbor/releases/latest | python3 - <<'PY'
import json, sys
data = json.load(sys.stdin)
print(data.get("tag_name", "").strip())
PY
for attempt in 1 2 3; do
version=$(curl -fsSL \
-H 'Accept: application/vnd.github+json' \
-H 'User-Agent: harbor-arm-build' \
https://api.github.com/repos/goharbor/harbor/releases/latest \
| jq -r '.tag_name // empty') || version=""
if [ -n "${version}" ]; then
echo "${version}"
exit 0
fi
sleep $((attempt * 5))
done
echo "Failed to resolve Harbor version from GitHub; set HARBOR_VERSION manually." >&2
exit 1
'''
).trim()
env.HARBOR_VERSION_RESOLVED = resolved