Add workshop identity to workshopctl requests - #1017
Open
tlm wants to merge 7 commits into
Open
Conversation
Collaborator
|
@tlm I can review it, but I think the tests are failing |
Expose UserProjects on the backend interface so callers can retrieve only the projects owned by the user in context without listing every user's projects. Reuse the new method in the LXD and fake backend implementations and return an empty result when the context does not identify a user.
Add middleware that copies an optional workshop instance ID header into the request context for downstream handlers. Define a shared typed context key and cover requests with and without the header while ensuring the next response function is always called.
Derive the test user's UID and GID from the user running the suite instead of assuming both are 1000. This allows LXD raw ID mapping to work on hosts where the test runner uses different numeric user and group IDs.
Add an instance ID to workshop runtime metadata and populate it from LXD's volatile UUID, normalized to match the value written to /etc/machine-id. Cover the mapping through the LXD backend integration suite.
Apply the workshop instance ID middleware to the workshopctl endpoint so a supplied instance ID is available to downstream request handling through the request context.
Use the invoking user's IDs for local integration runs, but retain the non-root workshop IDs when Spread executes the suite as root. This prevents LXD from trying to map host root into an unprivileged workshop instance.
tlm
force-pushed
the
system-sdk-secret-provider
branch
from
September 4, 2026 03:48
7283024 to
d7624be
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
Lay the groundwork for associating workshopctl requests with the workshop instance from which they originated.
Add user-scoped project lookup to workshop backends and expose the LXD instance UUID on loaded workshop metadata. The UUID is normalized to match the value written to
/etc/machine-id.Add request middleware that copies the optional
workshop-instance-idheader into the request context, and apply it to the workshopctl endpoint.This change only propagates workshop identity. Validation of the supplied instance ID will be added separately.
LXD integration test identity
Update the LXD integration fixture to use the test runner's numeric UID and GID rather than assuming both are
1000. Workshop instance configuration uses these values inraw.idmapto map the owning host user to the fixed workshop user inside the container.The previous fixture worked only on hosts where the test runner happened to use UID and GID
1000. On other hosts, those IDs can belong to different accounts or groups, causing LXD container creation to fail withoperation not permitted. Usinguser.Current()makes the mapping represent the user actually running the test while retaining the synthetictestusername and isolated LXD project. This is a test portability fix and does not change production identity handling.Testing
go test ./internal/workshop/fakebackend ./internal/workshop/lxd ./internal/overlord/workshopstatego test ./internal/daemon -check.f TestWithWorkshopInstanceIDgo test -v -tags integration ./internal/workshop/lxd/tests/integration -check.v -check.f TestLxdBackendWorkshopInstanceIDDocs