Update base image before launching or rebuilding a workshop#491
Merged
Conversation
13 tasks
2e324b5 to
8830244
Compare
dmitry-lyfar
approved these changes
Sep 22, 2025
8830244 to
dd4fe31
Compare
TICS Quality Gate✔️ PassedworkshopAll conditions passedSee the results in the TICS Viewer The following files have been checked for this project
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When launching a new workshop, or rebuilding one from an image (i.e. when refreshing after changing the
base), Workshop will now attempt to download the latest image for the givenbase. This PR does not affect refreshes which restore from SDK snapshots (but this is planned as the next step).To be safe I would probably clean up all local images before migrating to this version of Workshop. It will probably break wait-on-error launches and some refreshes.
There are some known issues with managing LXD images, most notably canonical/lxd#16515. I don't know of a viable workaround, but we haven't observed it in the wild yet, and I don't think this PR does anything to make it worse. It only triggers when another LXD project uses the same images as us. On my machine the other projects are
snapcraftandsdkcraft, and these both use a different image server (buildd).The way image downloads work is:
WorkshopManagercreates adownload-basetask if there's no SDK snapshot to restore from.WorkshopManagerpasses the ID of that task tocreate-workshop.download-basetask downloads the latest image and saves its fingerprint in the task data.create-workshoptask obtains the fingerprint from thedownload-basetask data and uses it to launch or rebuild a workshop.In
download-base, we query the image server before starting the download. This query is mostly redundant, we only use it to obtain the image size (and, for LXD servers, whether the image is public). If the image is updated before starting the download, the size might be inaccurate. We should fix this by adding numbers to LXD's progress reporting.A workaround would be to use the fingerprint from the query for the download. This seems to be safe, since LXD's image servers seem to keep at least 2 images per alias at all times. However, the resulting local copy of the image won't have any provenance information. I don't think it's worth losing this in order to remove a tiny chance of inaccurate progress reporting.
Last thing I'll mention is that we now use aliases like
24.04rather than24.04/amd64. This should be more reliable, see comments in code for more details.See #492 for the included bug fixes.
Fixes some minor style issues, and adds support for more image download progress string formats.
From what I've seen in the documentation, I think it already describes the state of affairs we're aiming for with this series of PRs.
Self-review quick check
Docs
Or: