Open AkihiroSuda opened 1 year ago
Maybe also some means of sharing them, with some kind of FROM system ?
Maybe also some means of sharing them, with some kind of FROM system ?
Yes, but that is a separate issue
Do you already have the link to the updated image? Or is that step needed as well? I expect you grab the checksum provided at the source, rather than generating it yourself, but please do confirm.
Do you already have the link to the updated image?
No, e.g., we have to detect the latest version 20230124-1270
from https://cloud.debian.org/images/cloud/bullseye/ , but I'm not sure what is the robust way to do this.
w3m | grep
might be enough, but seriously we should also consider adopting some machine learning stuff.
If I remember correctly, there was some standard metadata for scraping upstream for new releases to package...
Like https://wiki.debian.org/debian/watch
Maybe something like that can be used here, to "describe" the various vendors and where they put their binaries ?
Some thing simple, with place holders for date strings and checksums.
Example output:
https://qa.debian.org/cgi-bin/watch?pkg=containerd
Unfortunately, the others are not available as packages. But maybe something similar to this, but for images:
What about a naive bash/python script to replace placeholder strings in yaml? Something like:
ubuntu_image = `w3m | grep -e "xxx"`
sed -i "s/UBUNTU_IMAGE/$ubuntu_image/g" ubuntu.yaml
The robustness solely relies on consistent file naming of upstreams(counting on hyrum's law). Sadly I didn't find any public tool to retrive latest released images.
I'm now planning to use yq
How about using libosinfo (osinfo-db os
) ??
I could see their db has info of different os variants https://gitlab.com/libosinfo/osinfo-db/-/tree/main/data/os
We might need to write a python wrapper on top of this library (the tool osinfo-db is not giving out info on image download URL's by architecture that is present in the xml file)
yq
can read xml too
yq -p xml -P
The library and database are licensed under the terms of the GNU LGPL version 2 or later.
osinfo-db
Doesn't seem to contain permalinks: https://gitlab.com/libosinfo/osinfo-db/-/blob/ea8a7974a1f7189953c80fa9b1478b1ff8a75f8e/data/os/ubuntu.com/ubuntu-23.04.xml.in
<image arch="x86_64" format="qcow2" cloud-init="true">
<url>https://cloud-images.ubuntu.com/lunar/current/lunar-server-cloudimg-amd64.img</url>
</image>
yq can read xml too
True, but if we can use API it would be great. Else with yq we might need to read all xml files under each folder that we are interested in. With API i think it will be more managable
GNU LGPL version 2 or later
I thought since we are going to use this more of a build tool (Mostly a github actions workflow) this should not be a problem.
It was mostly referring to the "and database", most of the tools actually seem to be GPL v2 (and to require glib)
Doesn't seem to contain permalinks
True :( Supported examples are as below
I guess we can consider using GPT
For Ubuntu, this is implemented in the ironically named "simple streams" (it's 14M):
sudo apt install simplestreams ubuntu-keyring
sstream-query --json --max=1 --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://cloud-images.ubuntu.com/releases/streams/v1/com.ubuntu.cloud:released:download.sjson release='noble' ftype='disk1.img' | jq -r '.[] | [.item_url,.arch,.sha256]'
The JSON+GPG file is: http://cloud-images.ubuntu.com/releases/streams/v1/com.ubuntu.cloud:released:download.sjson
There is also a highlevel command:
sudo snap install image-status
$ image-status cloud-release
focal amd64 20240626 disk1.img
jammy amd64 20240627 disk1.img
mantic amd64 20240619 disk1.img
noble amd64 20240622 disk1.img
Where "disk1.img" is the old spelling of QCOW.
It is really hard for me to create a PR like https://github.com/lima-vm/lima/pull/1236 to update the template image digests.
We have to have a tool for updating these templates automatically. The tool must retain comment lines and indentation styles in the YAMLs.