Skip to content
Snippets Groups Projects
Unverified Commit 6608efb2 authored by Max Gautier's avatar Max Gautier
Browse files

download: compute version from Github tags for gvisor

Gvisor is the only one of our deployed components which use tags instead
of proper releases. So the tags scraping support will, for now, cater to
gvisor particularities, notably in the tag name format and the fact that
some older releases don't have the same URL scheme.
parent 479fda63
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,8 @@
import sys
import os
from itertools import groupby
from itertools import groupby, chain
from more_itertools import partition
from collections import defaultdict
from functools import cache
import argparse
......@@ -70,6 +71,18 @@ downloads = {
'url': "https://github.com/etcd-io/etcd/releases/download/v{version}/SHA256SUMS",
'graphql_id': "R_kgDOAKtHtg",
},
"gvisor_containerd_shim_binary": {
'url': "https://storage.googleapis.com/gvisor/releases/release/{version}/{alt_arch}/containerd-shim-runsc-v1.sha512",
'hashtype': "sha512",
'tags': True,
'graphql_id': "R_kgDOB9IlXg",
},
"gvisor_runsc_binary": {
'url': "https://storage.googleapis.com/gvisor/releases/release/{version}/{alt_arch}/runsc.sha512",
'hashtype': "sha512",
'tags': True,
'graphql_id': "R_kgDOB9IlXg",
},
"kata_containers_binary": {
'url': "https://github.com/kata-containers/kata-containers/releases/download/{version}/kata-static-{version}-{arch}.tar.xz",
'binary': True,
......@@ -179,10 +192,14 @@ def download_hash(only_downloads: [str]) -> None:
hash_file.raise_for_status()
return download_hash_extract[download](hash_file.content.decode())
nodes_ids = [x['graphql_id'] for x in downloads.values()]
releases, tags = map(dict,
partition(lambda r: r[1].get('tags', False),
{k: downloads[k] for k in (downloads.keys() & only_downloads)}.items()
))
ql_params = {
'repoWithReleases': nodes_ids,
'repoWithTags': [],
'repoWithReleases': [r['graphql_id'] for r in releases.values()],
'repoWithTags': [t['graphql_id'] for t in tags.values()],
}
with open("list_releases.graphql") as query:
response = s.post("https://api.github.com/graphql",
......@@ -197,15 +214,21 @@ def download_hash(only_downloads: [str]) -> None:
return Version(possible_version)
except InvalidVersion:
return None
github_versions = dict(zip(downloads.keys(),
rep = response.json()["data"]
github_versions = dict(zip(chain(releases.keys(), tags.keys()),
[
{
v for r in repo["releases"]["nodes"]
if not r["isPrerelease"]
and (v := valid_version(r["tagName"])) is not None
}
for repo in response.json()["data"]["with_releases"]
for repo in rep["with_releases"]
] +
[
{ v for t in repo["refs"]["nodes"]
if (v := valid_version(t["name"].removeprefix('release-'))) is not None
}
for repo in rep["with_tags"]
],
strict=True))
......
......@@ -45,4 +45,7 @@ gh api graphql -H "X-Github-Next-Global-ID: 1" -f query='{
crun: repository(owner: "containers", name: "crun") {
id
}
gvisor: repository(owner: "google", name: "gvisor") {
id
}
}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment