Fix fetching of keycloak versions
This commit is contained in:
parent
b1b6919395
commit
029cfcb591
@ -23,18 +23,44 @@ export async function getKeycloakDockerImageLatestSemVerTagsForEveryMajors(param
|
|||||||
|
|
||||||
const { buildContext } = params;
|
const { buildContext } = params;
|
||||||
|
|
||||||
const { tags } = await fetch(
|
const tags: string[] = [];
|
||||||
"https://quay.io/v2/keycloak/keycloak/tags/list",
|
|
||||||
buildContext.fetchOptions
|
await (async function callee(url: string) {
|
||||||
)
|
const r = await fetch(url, buildContext.fetchOptions);
|
||||||
.then(r => r.json())
|
|
||||||
.then(j =>
|
await Promise.all([
|
||||||
z
|
(async () => {
|
||||||
|
tags.push(
|
||||||
|
...z
|
||||||
.object({
|
.object({
|
||||||
tags: z.array(z.string())
|
tags: z.array(z.string())
|
||||||
})
|
})
|
||||||
.parse(j)
|
.parse(await r.json()).tags
|
||||||
);
|
);
|
||||||
|
})(),
|
||||||
|
(async () => {
|
||||||
|
const link = r.headers.get("link");
|
||||||
|
|
||||||
|
if (link === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const split = link.split(";").map(s => s.trim());
|
||||||
|
|
||||||
|
assert(split.length === 2);
|
||||||
|
|
||||||
|
assert(split[1] === 'rel="next"');
|
||||||
|
|
||||||
|
const match = split[0].match(/^<(.+)>$/);
|
||||||
|
|
||||||
|
assert(match !== null);
|
||||||
|
|
||||||
|
const nextUrl = new URL(url).origin + match[1];
|
||||||
|
|
||||||
|
await callee(nextUrl);
|
||||||
|
})()
|
||||||
|
]);
|
||||||
|
})("https://quay.io/v2/keycloak/keycloak/tags/list");
|
||||||
|
|
||||||
const arr = tags
|
const arr = tags
|
||||||
.map(tag => ({
|
.map(tag => ({
|
||||||
@ -73,7 +99,9 @@ export async function getKeycloakDockerImageLatestSemVerTagsForEveryMajors(param
|
|||||||
|
|
||||||
const supportedKeycloakMajorVersions = getSupportedKeycloakMajorVersions();
|
const supportedKeycloakMajorVersions = getSupportedKeycloakMajorVersions();
|
||||||
|
|
||||||
cache = Object.values(versionByMajor)
|
cache = Object.entries(versionByMajor)
|
||||||
|
.sort(([a], [b]) => parseInt(b) - parseInt(a))
|
||||||
|
.map(([, version]) => version)
|
||||||
.map(version => {
|
.map(version => {
|
||||||
assert(version !== undefined);
|
assert(version !== undefined);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user