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}" echo "${HARBOR_VERSION}"
exit 0 exit 0
fi fi
curl -sSL https://api.github.com/repos/goharbor/harbor/releases/latest | python3 - <<'PY' for attempt in 1 2 3; do
import json, sys version=$(curl -fsSL \
data = json.load(sys.stdin) -H 'Accept: application/vnd.github+json' \
print(data.get("tag_name", "").strip()) -H 'User-Agent: harbor-arm-build' \
PY 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() ).trim()
env.HARBOR_VERSION_RESOLVED = resolved env.HARBOR_VERSION_RESOLVED = resolved