Skip to content

Fix sdk info#517

Merged
dmitry-lyfar merged 4 commits into
mainfrom
fix/sdk-info-used-by-layers
Oct 21, 2025
Merged

Fix sdk info#517
dmitry-lyfar merged 4 commits into
mainfrom
fix/sdk-info-used-by-layers

Conversation

@jonathan-conder
Copy link
Copy Markdown
Contributor

@jonathan-conder jonathan-conder commented Oct 21, 2025

Description

I broke the sdk info command when introducing SDK layers, which can depend on SDK volumes but don't follow the usual workshop naming convention. For now at least, these are excluded from the list of workshops using the SDK volume, as are workshops and layers owned by other users.

Also fixes a couple of formatting nitpicks I had with sdk info, and adds spread tests for sdk info and sdk list.

For the tests I'm using snap alias workshop.sdk sdk, but we'll want to add this at the Store level. I'm not sure if doing that will remove the need to do it manually for locally-built snaps.

Self-review quick check

  • Make decisions that cost a lot to reverse explicit in the PR description.
  • Avoid nested conditions.
  • Delete dead code and redundant comments.
  • Normalise symmetries by sticking to doing identical things identically.
// one way to handle errors
if err := f(); err != nil {
   ...
}

// one way to handle multiple returns
val, err := f()
if err != nil {
   ...
}
...
  • Check that coupled code elements, files, and directories are adjacent. For example, test data is stored as close as possible to a test.
  • Put variable declaration and initialisation together.
  • Divide large expressions into digestable and self-explanatory ones. Use multiple variables if required.
  • Put a blank line between two logically different chunks of code.
  • Follow the style guide for new error messages.

Docs

  • I have checked and added or updated relevant documentation.
  • I have checked and added or updated relevant release notes.
  • I have included the technical author in the review.

Or:

  • I confirm the PR has no implications for documentation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the sdk info command which was broken when SDK layers were introduced. SDK layers can depend on SDK volumes but don't follow the workshop naming convention. The fix excludes these layers and workshops owned by other users from the list of workshops using an SDK volume. Additionally, it addresses formatting issues in the sdk info output and adds spread tests for both sdk info and sdk list commands.

Key changes:

  • Filters out SDK layers and other users' workshops when displaying SDK volume usage
  • Improves formatting of SDK description output by trimming trailing newlines
  • Conditionally displays "installed:" header only when there are installations
  • Adds comprehensive spread tests with helper utilities

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/workshop/lxd/lxd_backend_volume.go Adds project name filtering to exclude SDK layers and other users' workshops from volume info
cmd/sdk/info.go Fixes description formatting and conditionally displays "installed:" header
tests/main/sdk-info/task.yaml Adds spread test for sdk info command with multiple scenarios
tests/main/sdk-info/header.txt Test fixture for expected sdk info output header
tests/main/sdk-info/.workshop/stable.yaml Test workshop configuration for stable channel
tests/main/sdk-info/.workshop/edge.yaml Test workshop configuration for edge channel
tests/lib/utils.sh Adds sdk_exec helper function and snap alias setup
tests/lib/sdk/test-sdk-info/latest/stable/sdk/hooks/setup-base Test SDK hook for stable channel
tests/lib/sdk/test-sdk-info/latest/stable/meta/sdk.yaml Test SDK metadata for stable channel
tests/lib/sdk/test-sdk-info/latest/edge/sdk/hooks/setup-base Test SDK hook for edge channel
tests/lib/sdk/test-sdk-info/latest/edge/meta/sdk.yaml Test SDK metadata for edge channel

@github-actions
Copy link
Copy Markdown

TICS Quality Gate

✔️ Passed

workshop

All conditions passed

See the results in the TICS Viewer

The following files have been checked for this project
  • cmd/sdk/info.go
  • internal/workshop/lxd/lxd_backend_volume.go

Automatic-tests / code-coverage / TICS GitHub Action

@dmitry-lyfar dmitry-lyfar merged commit 82f21ca into main Oct 21, 2025
12 checks passed
@dmitry-lyfar dmitry-lyfar deleted the fix/sdk-info-used-by-layers branch October 21, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants