feat: add Compose profiles support to containers view - #571
feat: add Compose profiles support to containers view#571Vijay (h3110Fr13nd) wants to merge 4 commits into
Conversation
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Pull request overview
Adds Docker Compose profiles awareness to the Containers view by grouping profile-scoped services under profile “folders”, surfacing profile info in container tooltips/descriptions, and enabling compose actions to be scoped at the profile level.
Changes:
- Introduces
ComposeProfileGroupTreeItemand composes profile-based subtrees under compose project groups. - Adds compose profile discovery via
docker compose config --format jsonand uses it to tag/group services and show profile info in tooltips. - Extends compose group commands/menus to run against either a compose project group or a compose profile group (with a scope prompt).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/vscode-containers/src/tree/containers/ContainerTreeItem.ts | Adds “shared” indicator in description and includes compose profiles in tooltip rendering. |
| extensions/vscode-containers/src/tree/containers/ContainerGroupTreeItem.ts | Builds profile subtrees under compose project groups; updates sorting/ancestor logic for mixed children. |
| extensions/vscode-containers/src/tree/containers/composeProfiles.ts | New helper to derive compose profiles via docker compose config --format json. |
| extensions/vscode-containers/src/tree/containers/ComposeProfileGroupTreeItem.ts | New tree item representing a compose profile group and exposing service scoping helpers. |
| extensions/vscode-containers/src/commands/containers/composeGroup.ts | Allows compose commands to target either a compose project group or a profile group, with scope prompting. |
| extensions/vscode-containers/package.json | Enables compose group context menu commands on the new profile-group tree items. |
Suppressed comments (4)
extensions/vscode-containers/src/tree/containers/composeProfiles.ts:74
- Logging the first part of
docker compose configoutput can inadvertently expose expanded environment values/secrets to the output channel. Prefer logging only metadata (e.g. length) and only at debug level.
ext.outputChannel.appendLine(`[DEBUG] getComposeServiceProfiles stdout: ${stdout?.substring(0, 200)}...`);
extensions/vscode-containers/src/tree/containers/composeProfiles.ts:115
- This function intentionally falls back when
config --format jsonisn't available, so logging it as an error is noisy. Prefer debug-level logging (and stringify the error) when falling back.
ext.outputChannel.error(`getComposeServiceProfiles failed: ${err}`);
extensions/vscode-containers/src/commands/containers/composeGroup.ts:76
servicesscoping for the "down" action will currently pass service names todocker compose down, which the DockerComposeClientBase builds directly (see packages/vscode-container-client/src/clients/DockerComposeClientBase/DockerComposeClientBase.ts) and Docker Compose does not accept. This will cause the command to fail for the "services"/"exclusive" scopes. Consider forcing "profile" scope for down (or implementing service-scoped teardown via different commands).
// Ask the user whether to apply the command with the profile flag (which includes default
// services too), only to the explicit service names in this profile (excluding defaults),
// or strictly to services exclusive to this profile.
const scope = await pickComposeProfileCommandScope(context, node, commandName);
if (scope === 'profile') {
extensions/vscode-containers/src/commands/containers/composeGroup.ts:162
- composeGroup already has unit tests, but the new profile scoping logic (profile vs services vs exclusive) and the updated getComposeGroupLabels behavior (searching through profile sub-groups) aren't covered. Consider adding focused unit tests for these new branches to prevent regressions.
async function pickComposeProfileCommandScope(context: IActionContext, node: ComposeProfileGroupTreeItem, commandName: string): Promise<'profile' | 'services' | 'exclusive'> {
const exclusiveNames = node.getExclusiveServiceNames();
const picks: IAzureQuickPickItem<'profile' | 'services' | 'exclusive'>[] = [
{
Implements compose profile scope prompts, optimizes tree item sorting and UI formatting, and adds exclusive service scoping for Docker Compose profile actions. Signed-off-by: h3110Fr13nd <vijaysinghkushwaha3737@gmail.com>
Refines Compose profile behavior: - Localize user-facing shared profile indicator in container description. - Re-order command arguments in composeGroup to simplify call sites. - Use gated debug logging and prevent raw output secret exposure. - Resolve relative compose config file paths to basenames. - Add comprehensive unit tests for profile scoping and file helpers. Signed-off-by: h3110Fr13nd <vijaysinghkushwaha3737@gmail.com>
d87a42b to
ce9cef9
Compare
Consolidates Docker Compose label parsing, cleans up logging, and refines scoping: - Create central utils/composeLabels module for reusable label accessors and constants. - Eliminate duplicated getComposeFiles and getComposeSourceFiles functions across modules. - Extract profile command argument resolution into testable resolveComposeProfileArguments helper. - Remove verbose debug trace logging during routine container tree view loads. - Align unit test structure by relocating compose profiles tests under test/tree/containers/. - Add exhaustive unit tests for label normalization and profile action scoping. Signed-off-by: h3110Fr13nd <vijaysinghkushwaha3737@gmail.com>
|
have carefully taken profile views as subtree/branches making services in a profile groups appear in view for appropriate distinction. some design decision(may change)
Brandon Waterloo [MSFT] (@bwateratmsft) can you check whether there are nuances i've missed or i'm offtrack in assuming. feel free to suggest and change as appropriate.
|
|
Vijay (@h3110Fr13nd) can you add some screenshots and/or videos of the new stuff in action? |
Enhances the Compose logs command template and handler to support profile and service filtering:
- Update composeLogs command template in package.json to include ${profileList} and ${serviceList} variables.
- Pass profile (--profile) and service arguments to selectComposeLogsCommand in composeGroupLogs handler.
- Update selectComposeLogsCommand parameter list and command template variables to interpolate profiles and services.
Signed-off-by: h3110Fr13nd <vijaysinghkushwaha3737@gmail.com>
|
Brandon Waterloo [MSFT] (@bwateratmsft) while creating a video i realized the i've tested logs a little less, and they didn't provided service level scoping let alone profile level scoping, added them in the last commit and verified and here's a video on how it looks. Screencast.From.2026-08-06.01-19-46-hevc.mp4
|
Closes #570
Implements compose profile scope prompts, optimizes tree item sorting and UI formatting, and adds exclusive service scoping for Docker Compose profile actions.