Add workshop user to netdev and render groups for other bases#833
Open
jonathan-conder wants to merge 1 commit into
Open
Add workshop user to netdev and render groups for other bases#833jonathan-conder wants to merge 1 commit into
jonathan-conder wants to merge 1 commit into
Conversation
f83065b to
bcfbdd6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Workshop’s LXD backend cloud-init user-data to handle group-GID mismatches across Ubuntu bases/hosts (notably render and netdev) by adding the workshop user to multiple compatibility GIDs, and bumps the snapshot format revision accordingly so existing workshops can be refreshed consistently.
Changes:
- Extend the generated cloud-init config to include
create_groups: false, a YAMLgroups:list including compatibility GIDs, and abootcmdthat creates the required compat groups. - Bump the snapshot format revision to force rebuild/refresh behavior for the new on-disk format.
- Update the integration snapshot-format test expectations to the new
user.user-datahash.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/workshop/lxd/lxd_backend.go | Reworks cloud-init group membership injection to include compat GIDs and group creation via bootcmd. |
| internal/workshop/lxd/lxd_backend_snapshots.go | Bumps snapshot format revision from 1 → 2. |
| internal/workshop/lxd/tests/integration/snapshot-format.yaml | Updates expected snapshot config hashes to match the new cloud-init user-data. |
bcfbdd6 to
8453098
Compare
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
Different bases can have different IDs for a named group. This affects devices in the render group, for example GPU devices are given the
clockgroup in a 26.04 container on a 24.04 host.This PR works around the issue by adding the workshop user to all variants of the
rendergroup on supported hosts (Ubuntu 20.04 through 26.04). We can add more numbers as necessary for other distributions.To keep cloud-config the same for all bases, we list the groups by ID and set
create_groups: false. This means cloud-init passes the group IDs directly touseraddwithout trying to overwrite existing groups.Since
useraddrequires the groups to exist, so we need to create them ourselves. I don't think cloud-init provides a way to specify the ID of a new group, so we manually rungroupaddas part of abootcmdand ignore the "already exists" error codes.Compatibility
The GID changes will be picked up when users refresh their workshops, since I bumped the snapshot format revision. This is the first time we've done this, so I verified that old workshops continue to function after refreshing the snap (namely
launch --continueandrestore).At some point we can drop support for format revision 1, maybe after adding a warning. We should probably also make relevant tasks more robust to daemon downgrades (e.g. refuse to launch a workshop with format=3).
Futureproofing
This is intended to be a temporary workaround, but it might take some time to fix properly. So here's a script that generates the cloud-config. It's AI-generated but I think it's pretty solid:
Self-review quick check
Docs
Procedure:
Content:
tutorial/andhow-to/sections).docs/.coverage.yamlupdated, coverage tags added (.. artefact).Or: