fix: retry version resolution
This commit is contained in:
parent
acebc81af1
commit
23b4261424
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user