Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 137 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
"command": "vscode-containers.containers.composeGroup.stop",
"when": "config.containers.containers.groupBy == 'Compose Project Name'"
},
{
"command": "vscode-containers.containers.composeGroup.pull",
"when": "config.containers.containers.groupBy == 'Compose Project Name'"
},
{
"command": "vscode-containers.containers.composeGroup.restart",
"when": "never"
Expand All @@ -101,6 +105,10 @@
"command": "vscode-containers.compose.down",
"when": "isWorkspaceTrusted"
},
{
"command": "vscode-containers.compose.pull",
"when": "isWorkspaceTrusted"
},
{
"command": "vscode-containers.compose.restart",
"when": "isWorkspaceTrusted"
Expand All @@ -117,6 +125,10 @@
"command": "vscode-containers.compose.down.subset",
"when": "isWorkspaceTrusted"
},
{
"command": "vscode-containers.compose.pull.subset",
"when": "isWorkspaceTrusted"
},
{
"command": "vscode-containers.configure",
"when": "isWorkspaceTrusted"
Expand Down Expand Up @@ -177,6 +189,11 @@
"command": "vscode-containers.compose.down",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && editorLangId == dockercompose",
"command": "vscode-containers.compose.pull",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && editorLangId == dockercompose",
"command": "vscode-containers.compose.restart",
Expand All @@ -197,6 +214,11 @@
"command": "vscode-containers.compose.down.subset",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && editorLangId == dockercompose",
"command": "vscode-containers.compose.pull.subset",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && editorLangId == dockerfile",
"command": "vscode-containers.images.build",
Expand All @@ -214,6 +236,11 @@
"command": "vscode-containers.compose.down",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && resourceLangId == dockercompose",
"command": "vscode-containers.compose.pull",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && resourceLangId == dockercompose",
"command": "vscode-containers.compose.restart",
Expand All @@ -234,6 +261,11 @@
"command": "vscode-containers.compose.down.subset",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && resourceLangId == dockercompose",
"command": "vscode-containers.compose.pull.subset",
"group": "containers"
},
{
"when": "isWorkspaceTrusted && resourceLangId == dockerfile",
"command": "vscode-containers.images.build",
Expand Down Expand Up @@ -453,6 +485,11 @@
"when": "view == vscode-containers.views.containers && viewItem =~ /composeGroup$/i",
"group": "composeGroup_1_general@3"
},
{
"command": "vscode-containers.containers.composeGroup.pull",
"when": "view == vscode-containers.views.containers && viewItem =~ /composeGroup$/i",
"group": "composeGroup_1_general@4"
},
{
"command": "vscode-containers.containers.composeGroup.restart",
"when": "view == vscode-containers.views.containers && viewItem =~ /composeGroup$/i",
Expand Down Expand Up @@ -1970,6 +2007,86 @@
"advanced"
]
},
"containers.commands.composePull": {
"oneOf": [
{
"type": "array",
"items": {
"properties": {
"template": {
"type": "string",
"description": "%vscode-containers.config.template.composePull.template%"
},
"label": {
"type": "string",
"description": "%vscode-containers.config.template.composePull.label%"
},
"match": {
"type": "string",
"description": "%vscode-containers.config.template.composePull.match%"
}
},
"required": [
"label",
"template"
]
}
},
{
"type": "string"
}
],
"default": [
{
"label": "Compose Pull",
"template": "${composeCommand} ${configurationFile} pull"
}
],
"description": "%vscode-containers.config.template.composePull.description%",
"tags": [
"advanced"
]
},
"containers.commands.composePullSubset": {
"oneOf": [
{
"type": "array",
"items": {
"properties": {
"template": {
"type": "string",
"description": "%vscode-containers.config.template.composePullSubset.template%"
},
"label": {
"type": "string",
"description": "%vscode-containers.config.template.composePullSubset.label%"
},
"match": {
"type": "string",
"description": "%vscode-containers.config.template.composePullSubset.match%"
}
},
"required": [
"label",
"template"
]
}
},
{
"type": "string"
}
],
"default": [
{
"label": "Compose Pull",
"template": "${composeCommand} ${profileList} ${configurationFile} pull ${serviceList}"
}
],
"description": "%vscode-containers.config.template.composePullSubset.description%",
"tags": [
"advanced"
]
},
"containers.containers.groupBy": {
"type": "string",
"default": "Compose Project Name",
Expand Down Expand Up @@ -2598,6 +2715,16 @@
"title": "%vscode-containers.commands.compose.down.subset%",
"category": "%vscode-containers.commands.category.containersGeneric%"
},
{
"command": "vscode-containers.compose.pull",
"title": "%vscode-containers.commands.compose.pull%",
"category": "%vscode-containers.commands.category.containersGeneric%"
},
{
"command": "vscode-containers.compose.pull.subset",
"title": "%vscode-containers.commands.compose.pull.subset%",
"category": "%vscode-containers.commands.category.containersGeneric%"
},
{
"command": "vscode-containers.configure",
"title": "%vscode-containers.commands.configure%",
Expand Down Expand Up @@ -2713,6 +2840,11 @@
"title": "%vscode-containers.commands.containers.composeGroup.stop%",
"category": "%vscode-containers.commands.category.containers%"
},
{
"command": "vscode-containers.containers.composeGroup.pull",
"title": "%vscode-containers.commands.containers.composeGroup.pull%",
"category": "%vscode-containers.commands.category.containers%"
},
{
"command": "vscode-containers.containers.composeGroup.restart",
"title": "%vscode-containers.commands.containers.composeGroup.restart%",
Expand Down Expand Up @@ -3238,7 +3370,9 @@
"onCommand:vscode-containers.images.run",
"onCommand:vscode-containers.compose.up",
"onCommand:vscode-containers.compose.up.subset",
"onCommand:vscode-containers.compose.down.subset"
"onCommand:vscode-containers.compose.down.subset",
"onCommand:vscode-containers.compose.pull",
"onCommand:vscode-containers.compose.pull.subset"
],
"description": "%vscode-containers.walkthrough.containersStart.runContainer.description%",
"media": {
Expand Down Expand Up @@ -3330,6 +3464,8 @@
"containers.commands.composeUp",
"containers.commands.composeUpSubset",
"containers.commands.composeDown",
"containers.commands.composePull",
"containers.commands.composePullSubset",
"containers.environment",
"containers.scaffolding.templatePath",
"containers.containerCommand",
Expand Down
11 changes: 11 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@
"vscode-containers.config.template.composeDown.label": "The label displayed to the user.",
"vscode-containers.config.template.composeDown.match": "The regular expression for choosing the right template. Checked against compose YAML files, folder name, etc.",
"vscode-containers.config.template.composeDown.description": "Command templates for compose down commands.",
"vscode-containers.config.template.composePull.template": "The command template.",
"vscode-containers.config.template.composePull.label": "The label displayed to the user.",
"vscode-containers.config.template.composePull.match": "The regular expression for choosing the right template. Checked against compose YAML files, folder name, etc.",
"vscode-containers.config.template.composePull.description": "Command templates for compose pull commands.",
"vscode-containers.config.template.composePullSubset.template": "The command template.",
"vscode-containers.config.template.composePullSubset.label": "The label displayed to the user.",
"vscode-containers.config.template.composePullSubset.match": "The regular expression for choosing the right template. Checked against compose YAML files, folder name, etc.",
"vscode-containers.config.template.composePullSubset.description": "Command templates for compose pull (subset) commands.",
"vscode-containers.config.containers.containers.groupBy": "The property to use to group containers in Containers view: ContainerId, ContainerName, CreatedTime, FullTag, ImageId, Networks, Ports, Registry, RegistryAndPath, Repository, RepositoryName, RepositoryNameShort, RepositoryNameAndTag, State, Status, Tag, or None",
"vscode-containers.config.containers.containers.groupByLabel": "The items will be grouped by the value of this container label (e.g. `com.microsoft.created-by`)",
"vscode-containers.config.containers.containers.description": "Any secondary properties to display for a container (an array). Possible elements include: ContainerId, ContainerName, CreatedTime, FullTag, ImageId, Networks, Ports, Registry, RegistryAndPath, Repository, RepositoryName, RepositoryNameShort, RepositoryNameAndTag, State, Status, and Tag",
Expand Down Expand Up @@ -214,6 +222,8 @@
"vscode-containers.commands.compose.up": "Compose Up",
"vscode-containers.commands.compose.up.subset": "Compose Up - Select Services",
"vscode-containers.commands.compose.down.subset": "Compose Down - Select Services",
"vscode-containers.commands.compose.pull": "Compose Pull",
"vscode-containers.commands.compose.pull.subset": "Compose Pull - Select Services",
"vscode-containers.commands.configure": "Add Docker Files to Workspace...",
"vscode-containers.commands.configureCompose": "Add Compose Files to Workspace...",
"vscode-containers.commands.containers.attachShell": "Attach Shell",
Expand All @@ -237,6 +247,7 @@
"vscode-containers.commands.containers.composeGroup.logs": "Compose Logs",
"vscode-containers.commands.containers.composeGroup.start": "Compose Start",
"vscode-containers.commands.containers.composeGroup.stop": "Compose Stop",
"vscode-containers.commands.containers.composeGroup.pull": "Compose Pull",
"vscode-containers.commands.containers.composeGroup.restart": "Compose Restart",
"vscode-containers.commands.containers.composeGroup.down": "Compose Down",
"vscode-containers.commands.debugging.initializeForDebugging": "Initialize for container debugging",
Expand Down
16 changes: 13 additions & 3 deletions src/commands/compose/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import { quickPickWorkspaceFolder } from '../../utils/quickPickWorkspaceFolder';
import { selectComposeCommand } from '../selectCommandTemplate';
import { getComposeProfileList, getComposeProfilesOrServices, getComposeServiceList, getDefaultCommandComposeProfilesOrServices } from './getComposeSubsetList';

async function compose(context: IActionContext, commands: ('up' | 'down' | 'upSubset' | 'downSubset')[], message: string, dockerComposeFileUri?: vscode.Uri | string, selectedComposeFileUris?: vscode.Uri[], preselectedServices?: string[], preselectedProfiles?: string[]): Promise<void> {
type ComposeCommand = 'up' | 'down' | 'upSubset' | 'downSubset' | 'pull' | 'pullSubset';

async function compose(context: IActionContext, commands: ComposeCommand[], message: string, dockerComposeFileUri?: vscode.Uri | string, selectedComposeFileUris?: vscode.Uri[], preselectedServices?: string[], preselectedProfiles?: string[]): Promise<void> {
if (!vscode.workspace.isTrusted) {
throw new UserCancelledError('enforceTrust');
}
Expand Down Expand Up @@ -67,9 +69,9 @@ async function compose(context: IActionContext, commands: ('up' | 'down' | 'upSu
if (!terminalCommand.args?.length) {
// Add the service list if needed
terminalCommand.command = await addServicesOrProfilesIfNeeded(context, folder, terminalCommand.command, preselectedServices, preselectedProfiles);
} else if (command === 'upSubset' || command === 'downSubset') {
} else if (command === 'upSubset' || command === 'downSubset' || command === 'pullSubset') {
// If there are arguments, it means we're using a default command (based on the logic in selectCommandTemplate.ts)
// So, we only want to add profile/service list for the upSubset or downSubset command
// So, we only want to add profile/service list for the subset commands
terminalCommand = await addDefaultCommandServicesOrProfilesIfNeeded(context, folder, terminalCommand, preselectedServices, preselectedProfiles);
}

Expand Down Expand Up @@ -102,6 +104,14 @@ export async function composeDownSubset(context: IActionContext, dockerComposeFi
return await compose(context, ['downSubset'], vscode.l10n.t('Choose compose file to take down'), dockerComposeFileUri, selectedComposeFileUris, preselectedServices, preselectedProfiles);
}

export async function composePull(context: IActionContext, dockerComposeFileUri?: vscode.Uri | string, selectedComposeFileUris?: vscode.Uri[]): Promise<void> {
return await compose(context, ['pull'], vscode.l10n.t('Choose compose file to pull images for'), dockerComposeFileUri, selectedComposeFileUris);
}

export async function composePullSubset(context: IActionContext, dockerComposeFileUri?: vscode.Uri | string, selectedComposeFileUris?: vscode.Uri[], preselectedServices?: string[], preselectedProfiles?: string[]): Promise<void> {
return await compose(context, ['pullSubset'], vscode.l10n.t('Choose compose file to pull selected services from'), dockerComposeFileUri, selectedComposeFileUris, preselectedServices, preselectedProfiles);
}

export async function composeRestart(context: IActionContext, dockerComposeFileUri?: vscode.Uri, selectedComposeFileUris?: vscode.Uri[]): Promise<void> {
return await compose(context, ['down', 'up'], vscode.l10n.t('Choose compose file to restart'), dockerComposeFileUri, selectedComposeFileUris);
}
Expand Down
Loading
Loading