@devcontainers/cli
Advanced tools
Comparing version 0.14.0 to 0.14.1
@@ -7,2 +7,6 @@ # Change Log | ||
### [0.14.1] | ||
- Replace containerEnv in entire config and in read-configuration command. (https://github.com/microsoft/vscode-remote-release/issues/7121) | ||
### [0.14.0] | ||
@@ -9,0 +13,0 @@ |
@@ -176,5 +176,6 @@ "use strict"; | ||
const computeRemoteEnv = params.computeExtensionHostEnv || params.postCreate.enabled; | ||
const remoteEnv = computeRemoteEnv ? probeRemoteEnv(params, containerProperties, config) : Promise.resolve({}); | ||
const updatedConfig = (0, variableSubstitution_1.containerSubstitute)(params.cliHost.platform, config.configFilePath, containerProperties.env, config); | ||
const remoteEnv = computeRemoteEnv ? probeRemoteEnv(params, containerProperties, updatedConfig) : Promise.resolve({}); | ||
if (params.postCreate.enabled) { | ||
await runPostCreateCommands(params, containerProperties, config, remoteEnv, false); | ||
await runPostCreateCommands(params, containerProperties, updatedConfig, remoteEnv, false); | ||
} | ||
@@ -191,3 +192,3 @@ return { | ||
...params.remoteEnv, | ||
...config.remoteEnv ? (0, variableSubstitution_1.containerSubstitute)(params.cliHost.platform, config.configFilePath, containerProperties.env, config.remoteEnv) : {}, | ||
...config.remoteEnv, | ||
})); | ||
@@ -194,0 +195,0 @@ } |
@@ -53,2 +53,3 @@ "use strict"; | ||
const info_1 = require("./featuresCLI/info"); | ||
const variableSubstitution_1 = require("../spec-common/variableSubstitution"); | ||
const defaultDefaultUserEnvProbe = 'loginInteractiveShell'; | ||
@@ -496,4 +497,5 @@ (async () => { | ||
const containerProperties = await (0, utils_1.createContainerProperties)(params, container.Id, workspaceConfig.workspaceFolder, config.remoteUser); | ||
const remoteEnv = (0, injectHeadless_1.probeRemoteEnv)(common, containerProperties, config); | ||
const result = await (0, injectHeadless_1.runPostCreateCommands)(common, containerProperties, config, remoteEnv, stopForPersonalization); | ||
const updatedConfig = (0, variableSubstitution_1.containerSubstitute)(cliHost.platform, config.configFilePath, containerProperties.env, config); | ||
const remoteEnv = (0, injectHeadless_1.probeRemoteEnv)(common, containerProperties, updatedConfig); | ||
const result = await (0, injectHeadless_1.runPostCreateCommands)(common, containerProperties, updatedConfig, remoteEnv, stopForPersonalization); | ||
return { | ||
@@ -525,4 +527,8 @@ outcome: 'success', | ||
'user-data-folder': { type: 'string', description: 'Host path to a directory that is intended to be persisted and share state between sessions.' }, | ||
'docker-path': { type: 'string', description: 'Docker CLI path.' }, | ||
'docker-compose-path': { type: 'string', description: 'Docker Compose CLI path.' }, | ||
'workspace-folder': { type: 'string', required: true, description: 'Workspace folder path. The devcontainer.json will be looked up relative to this path.' }, | ||
'mount-workspace-git-root': { type: 'boolean', default: true, description: 'Mount the workspace using its Git root.' }, | ||
'container-id': { type: 'string', description: 'Id of the container to run the user commands for.' }, | ||
'id-label': { type: 'string', description: 'Id label(s) of the format name=value. If no --container-id is given the id labels will be used to look up the container. If no --id-label is given, one will be inferred from the --workspace-folder path.' }, | ||
'config': { type: 'string', description: 'devcontainer.json path. The default is to use .devcontainer/devcontainer.json or, if that does not exist, .devcontainer.json in the workspace folder.' }, | ||
@@ -536,2 +542,9 @@ 'override-config': { type: 'string', description: 'devcontainer.json path to override any devcontainer.json in the workspace folder (or built-in configuration). This is required when there is no devcontainer.json otherwise.' }, | ||
'skip-feature-auto-mapping': { type: 'boolean', default: false, hidden: true, description: 'Temporary option for testing.' }, | ||
}) | ||
.check(argv => { | ||
const idLabels = (argv['id-label'] && (Array.isArray(argv['id-label']) ? argv['id-label'] : [argv['id-label']])); | ||
if (idLabels === null || idLabels === void 0 ? void 0 : idLabels.some(idLabel => !/.+=.+/.test(idLabel))) { | ||
throw new Error('Unmatched argument format: id-label must match <name>=<value>'); | ||
} | ||
return true; | ||
}); | ||
@@ -544,3 +557,3 @@ } | ||
// 'user-data-folder': persistedFolder, | ||
'workspace-folder': workspaceFolderArg, 'mount-workspace-git-root': mountWorkspaceGitRoot, config: configParam, 'override-config': overrideConfig, 'log-level': logLevel, 'log-format': logFormat, 'terminal-rows': terminalRows, 'terminal-columns': terminalColumns, 'include-features-configuration': includeFeaturesConfig, 'skip-feature-auto-mapping': skipFeatureAutoMapping, }) { | ||
'docker-path': dockerPath, 'docker-compose-path': dockerComposePath, 'workspace-folder': workspaceFolderArg, 'mount-workspace-git-root': mountWorkspaceGitRoot, config: configParam, 'override-config': overrideConfig, 'container-id': containerId, 'id-label': idLabel, 'log-level': logLevel, 'log-format': logFormat, 'terminal-rows': terminalRows, 'terminal-columns': terminalColumns, 'include-features-configuration': includeFeaturesConfig, 'skip-feature-auto-mapping': skipFeatureAutoMapping, }) { | ||
const disposables = []; | ||
@@ -553,2 +566,3 @@ const dispose = async () => { | ||
const workspaceFolder = path.resolve(process.cwd(), workspaceFolderArg); | ||
const idLabels = idLabel ? (Array.isArray(idLabel) ? idLabel : [idLabel]) : getDefaultIdLabels(workspaceFolder); | ||
const configFile = configParam ? vscode_uri_1.URI.file(path.resolve(process.cwd(), configParam)) : undefined; | ||
@@ -576,6 +590,24 @@ const overrideConfigFile = overrideConfig ? vscode_uri_1.URI.file(path.resolve(process.cwd(), overrideConfig)) : undefined; | ||
} | ||
let { config: configuration } = configs; | ||
const dockerCLI = dockerPath || 'docker'; | ||
const dockerComposeCLI = (0, dockerCompose_1.dockerComposeCLIConfig)({ | ||
exec: cliHost.exec, | ||
env: cliHost.env, | ||
output, | ||
}, dockerCLI, dockerComposePath || 'docker-compose'); | ||
const params = { | ||
cliHost, | ||
dockerCLI, | ||
dockerComposeCLI, | ||
env: cliHost.env, | ||
output | ||
}; | ||
const container = containerId ? await (0, dockerUtils_1.inspectContainer)(params, containerId) : await (0, singleContainer_1.findDevContainer)(params, idLabels); | ||
if (container) { | ||
configuration = (0, variableSubstitution_1.containerSubstitute)(cliHost.platform, configuration.configFilePath, (0, utils_1.envListToObj)(container.Config.Env), configuration); | ||
} | ||
const featuresConfiguration = includeFeaturesConfig ? await (0, containerFeaturesConfiguration_1.generateFeaturesConfig)({ extensionPath, cwd, output, env: cliHost.env, skipFeatureAutoMapping }, (await (0, utils_1.createFeaturesTempFolder)({ cliHost, package: pkg })), configs.config, containerFeaturesConfiguration_1.getContainerFeaturesFolder) : undefined; | ||
await new Promise((resolve, reject) => { | ||
process.stdout.write(JSON.stringify({ | ||
configuration: configs.config, | ||
configuration, | ||
workspace: configs.workspaceConfig, | ||
@@ -712,3 +744,4 @@ featuresConfiguration, | ||
const containerProperties = await (0, utils_1.createContainerProperties)(params, container.Id, workspaceConfig.workspaceFolder, config.remoteUser); | ||
const remoteEnv = (0, injectHeadless_1.probeRemoteEnv)(common, containerProperties, config); | ||
const updatedConfig = (0, variableSubstitution_1.containerSubstitute)(cliHost.platform, config.configFilePath, containerProperties.env, config); | ||
const remoteEnv = (0, injectHeadless_1.probeRemoteEnv)(common, containerProperties, updatedConfig); | ||
const remoteCwd = containerProperties.remoteWorkspaceFolder || containerProperties.homeFolder; | ||
@@ -715,0 +748,0 @@ const infoOutput = (0, log_1.makeLog)(output, log_1.LogLevel.Info); |
@@ -93,2 +93,3 @@ /// <reference types="node" /> | ||
export declare function createContainerProperties(params: DockerResolverParameters, containerId: string, remoteWorkspaceFolder: string | undefined, remoteUser: string | undefined, rootShellServer?: ShellServer): Promise<ContainerProperties>; | ||
export declare function envListToObj(list: string[] | null): NodeJS.ProcessEnv; | ||
export declare function runUserCommand(params: DockerResolverParameters, command: string | string[] | undefined, onDidInput?: Event<string>): Promise<void>; | ||
@@ -95,0 +96,0 @@ export declare function getFolderImageName(params: ResolverParameters | DockerCLIParameters): string; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensureDockerfileHasFinalStageName = exports.internalGetImageUser = exports.getImageUser = exports.getLocalCacheFolder = exports.getCacheFolder = exports.createFeaturesTempFolder = exports.getFolderHash = exports.getFolderImageName = exports.runUserCommand = exports.createContainerProperties = exports.getDockerContextPath = exports.getTunnelInformation = exports.getWorkspaceConfiguration = exports.getHostMountFolder = exports.isDevContainerAuthority = exports.inspectDockerImage = exports.startEventSeen = exports.uriToWSLFsPath = exports.getPackageConfig = exports.RemoteDocuments = exports.fileDocuments = exports.createDocuments = exports.CLIHostDocuments = exports.parentURI = exports.uriToFsPath = exports.resolveConfigFilePath = exports.isDockerFileConfig = exports.getDockerfilePath = exports.getConfigFilePath = void 0; | ||
exports.ensureDockerfileHasFinalStageName = exports.internalGetImageUser = exports.getImageUser = exports.getLocalCacheFolder = exports.getCacheFolder = exports.createFeaturesTempFolder = exports.getFolderHash = exports.getFolderImageName = exports.runUserCommand = exports.envListToObj = exports.createContainerProperties = exports.getDockerContextPath = exports.getTunnelInformation = exports.getWorkspaceConfiguration = exports.getHostMountFolder = exports.isDevContainerAuthority = exports.inspectDockerImage = exports.startEventSeen = exports.uriToWSLFsPath = exports.getPackageConfig = exports.RemoteDocuments = exports.fileDocuments = exports.createDocuments = exports.CLIHostDocuments = exports.parentURI = exports.uriToFsPath = exports.resolveConfigFilePath = exports.isDockerFileConfig = exports.getDockerfilePath = exports.getConfigFilePath = void 0; | ||
const path = __importStar(require("path")); | ||
@@ -241,2 +241,3 @@ const crypto = __importStar(require("crypto")); | ||
} | ||
exports.envListToObj = envListToObj; | ||
async function runUserCommand(params, command, onDidInput) { | ||
@@ -243,0 +244,0 @@ if (!command) { |
{ | ||
"name": "@devcontainers/cli", | ||
"description": "Dev Containers CLI", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "devcontainer": "devcontainer.js" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1901182
14960