Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
ARG VARIANT="20-bookworm"
ARG VARIANT="22-bookworm"
FROM mcr.microsoft.com/devcontainers/typescript-node:1-${VARIANT}

RUN mkdir -p /workspaces && chown node:node /workspaces
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "20-bookworm"
"VARIANT": "22-bookworm"
}
},
"mounts": [
Expand Down
12 changes: 3 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ updates:
patterns:
- "*"
ignore:
- dependency-name: "@types/chai"
update-types: ["version-update:semver-major"] # chai 4 to avoid esm
- dependency-name: "@types/node"
update-types: ["version-update:semver-major"] # Keep Node 20 compatibility
- dependency-name: "chai"
update-types: ["version-update:semver-major"] # chai 4 to avoid esm
- dependency-name: "yargs"
update-types: ["version-update:semver-major"] # yargs 17 for esbuild CJS bundling
- dependency-name: "node-pty"
update-types: ["version-update:semver-minor"] # node-pty 1.1 has broken spawn-helper permissions (microsoft/node-pty#866)
update-types: ["version-update:semver-major"] # Keep Node 22 compatibility
- dependency-name: "typescript"
update-types: ["version-update:semver-major"] # TypeScript 7 has no JS API yet (needed by typescript-eslint, ts-node, typescript-formatter)
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/dev-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v5
with:
node-version: '20.x'
node-version: '22.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@microsoft'
- name: Install Dependencies
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20.x'
node-version: '22.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@microsoft'
- name: Disable containerd image store
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20.x'
node-version: '22.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@microsoft'
- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docker-v20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-node@v5
with:
node-version: '20.x'
node-version: '22.x'

- name: Install Docker v20.10
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docker-v29.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: actions/setup-node@v5
with:
node-version: '20.x'
node-version: '22.x'

- name: Install Docker v29.0.0
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20.x'
node-version: '22.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@microsoft'
- name: Install Dependencies
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Notable changes.

## December 2026

### [0.92.0]
- Require Node.js 22. (https://github.com/devcontainers/cli/pull/1365)
- Dependency updates. (https://github.com/devcontainers/cli/pull/1365)

## November 2026

### [0.91.0]
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This guide covers everything you need to set up a development environment, build

## Prerequisites

- [Node.js](https://nodejs.org/) >= 20
- [Node.js](https://nodejs.org/) >= 22
- [Docker](https://www.docker.com/) (required for running integration tests — they create real containers)
- [Git](https://git-scm.com/)
- [yarn](https://yarnpkg.com/) (used for dependency installation)
Expand All @@ -30,7 +30,7 @@ You are ready to build and test.

### Option B: Local setup

1. Install Node.js >= 20 and Docker.
1. Install Node.js >= 22 and Docker.
2. Install dependencies:

```sh
Expand Down
26 changes: 18 additions & 8 deletions esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
const esbuild = require('esbuild');
const fs = require('fs');
const path = require('path');
const uri = require('vscode-uri');

const minify = process.argv.indexOf('--production') !== -1;
const watch = process.argv.indexOf('--watch') !== -1;
Expand All @@ -18,14 +17,15 @@ const watch = process.argv.indexOf('--watch') !== -1;
const plugin = {
name: 'patch up',
setup(build) {
build.onLoad({ filter: /node_modules[\/\\]yargs[\/\\]lib[\/\\]platform-shims[\/\\]esm\.mjs$/ }, async (args) => {
let text = await fs.promises.readFile(args.path, 'utf8');
let fileUri = uri.URI.file(args.path);
fileUri = fileUri.with({
path: path.posix.join('/C:', fileUri.path)
});
// pac-proxy-agent reads quickjs.wasm from its package folder, which is not part of the bundle. Inline it instead.
build.onLoad({ filter: /node_modules[\/\\]pac-proxy-agent[\/\\]dist[\/\\]index\.js$/ }, async (args) => {
const text = await fs.promises.readFile(args.path, 'utf8');
const wasmRead = `readFile(new URL(import.meta.resolve('quickjs-wasi/quickjs.wasm')))`;
if (!text.includes(wasmRead)) {
throw new Error(`Could not patch quickjs.wasm loading in ${args.path}.`);
}
return {
contents: text.replace(/import\.meta\.url/g, `'${fileUri.toString()}'`),
contents: `import quickjsWasmBinary from 'quickjs-wasi/quickjs.wasm';\n${text.replace(wasmRead, 'Promise.resolve(quickjsWasmBinary)')}`,
loader: 'js',
};
});
Expand Down Expand Up @@ -68,12 +68,22 @@ const watch = process.argv.indexOf('--watch') !== -1;
mainFields: ['module', 'main'],
outdir: 'dist',
plugins: [plugin],
loader: {
'.wasm': 'binary',
},
// The bundle is CommonJS, map import.meta of bundled ES modules to the bundle file.
define: {
'import.meta.url': '__importMetaUrl',
'import.meta.resolve': '__importMetaResolve',
},
banner: {
js: `
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const __importMetaUrl = require('url').pathToFileURL(__filename).href;
const __importMetaResolve = (specifier) => require('url').pathToFileURL(require.resolve(specifier)).href;
`.trimStart()
},
entryPoints: [
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"license": "MIT",
"engines": {
"node": ">=20.0.0"
"node": ">=22.12.0"
},
"scripts": {
"compile": "npm-run-all clean-dist compile-dev",
Expand Down Expand Up @@ -54,57 +54,57 @@
"scripts/updateUID.Dockerfile"
],
"devDependencies": {
"@stylistic/eslint-plugin": "^5.10.0",
"@types/chai": "^4.3.20",
"@stylistic/eslint-plugin": "^6.0.1",
"@types/chai": "^5.2.3",
"@types/follow-redirects": "^1.14.4",
"@types/js-yaml": "^4.0.9",
"@types/mocha": "^10.0.10",
"@types/ncp": "^2.0.8",
"@types/node": "^20.19.37",
"@types/node": "^22.20.7",
"@types/pull-stream": "^3.6.7",
"@types/recursive-readdir": "^2.2.4",
"@types/semver": "^7.7.1",
"@types/semver": "^7.8.0",
"@types/shell-quote": "^1.7.5",
"@types/text-table": "^0.2.5",
"@types/yargs": "^17.0.35",
"@typescript-eslint/eslint-plugin": "^8.56.1",
"@typescript-eslint/parser": "^8.56.1",
"chai": "^4.5.0",
"@typescript-eslint/eslint-plugin": "^8.74.0",
"@typescript-eslint/parser": "^8.74.0",
"chai": "^6.3.0",
"copyfiles": "^2.4.1",
"esbuild": "^0.28.1",
"eslint": "^10.0.2",
"esbuild": "^0.28.2",
"eslint": "^10.16.0",
"event-stream": "^4.0.1",
"minimatch": "^10.2.4",
"mocha": "^11.7.5",
"minimatch": "^11.0.10",
"mocha": "^12.0.3",
"npm-run-all": "^4.1.5",
"p-all": "^5.0.1",
"rimraf": "^6.1.3",
"rimraf": "^6.1.4",
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"typescript": "^6.0.3",
"typescript-formatter": "^7.2.2",
"vinyl": "^3.0.1",
"vinyl-fs": "^4.0.2"
},
"dependencies": {
"chalk": "^5.6.2",
"follow-redirects": "^1.15.11",
"js-yaml": "^4.1.1",
"chalk": "^6.0.1",
"follow-redirects": "^1.16.3",
"js-yaml": "^5.5.0",
Comment thread
chrmarti marked this conversation as resolved.
Resolved
"jsonc-parser": "^3.3.1",
"ncp": "^2.0.0",
"node-pty": "~1.0.0",
"proxy-agent": "^6.5.0",
"node-pty": "^1.2.0-beta.19",
"proxy-agent": "^8.0.3",
"pull-stream": "^3.7.0",
"recursive-readdir": "^2.2.3",
"semver": "^7.7.4",
"shell-quote": "^1.8.3",
"semver": "^7.8.6",
"shell-quote": "^1.12.0",
"stream-to-pull-stream": "^1.7.3",
"tar": "^7.5.10",
"tar": "^8.1.0",
"text-table": "^0.2.0",
"vscode-uri": "^3.1.0",
"yargs": "~17.7.2"
"vscode-uri": "^3.2.0",
"yargs": "^18.2.0"
},
"resolutions": {
"basic-ftp": "^6.2.3",
"mocha/glob": "^14.0.7",
"mocha/minimatch": "^11.0.10",
"serialize-javascript": "^7.1.3"
}
}
6 changes: 3 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Options:
# --prefix DIR Installation directory (default: ~/.devcontainers)
# --version VER Dev Containers CLI version to install (default: latest)
# --node-version VER Node.js major version (default: 20)
# --node-version VER Node.js major version (default: 22)
# --update Update existing installation to latest versions
# --uninstall Remove the installation
# --help Show this help message
Expand All @@ -21,7 +21,7 @@ set -e
# Default configuration
INSTALL_PREFIX="${DEVCONTAINERS_INSTALL_DIR:-$HOME/.devcontainers}"
CLI_VERSION="latest"
NODE_MAJOR_VERSION="20"
NODE_MAJOR_VERSION="22"
UPDATE_MODE=false
UNINSTALL_MODE=false

Expand Down Expand Up @@ -68,7 +68,7 @@ Usage:
Options:
--prefix DIR Installation directory (default: ~/.devcontainers)
--version VER Dev Containers CLI version to install (default: latest)
--node-version VER Node.js major version (default: 20)
--node-version VER Node.js major version (default: 22)
--update Update existing installation to latest versions
--uninstall Remove the installation
--help Show this help message
Expand Down
4 changes: 2 additions & 2 deletions src/spec-configuration/containerCollectionsOCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export async function getBlob(params: CommonParams, url: string, ociCacheDir: st
file: tempTarballPath,
cwd: destCachePath,
filter: (tPath, stat) => {
const entryType = 'type' in stat ? stat.type : (stat.isFile() ? 'File' : stat.isDirectory() ? 'Directory' : 'Other');
const entryType = stat.type;
output.write(`Testing '${tPath}'(${entryType})`, LogLevel.Trace);
const cleanedPath = tPath
.replace(/\\/g, '/')
Expand All @@ -594,7 +594,7 @@ export async function getBlob(params: CommonParams, url: string, ociCacheDir: st
return false; // Skip
}

const isFile = 'type' in stat ? stat.type === 'File' : stat.isFile();
const isFile = stat.type === 'File';
if (isFile) {
files.push(tPath);
}
Expand Down
6 changes: 0 additions & 6 deletions src/spec-configuration/typings/zlib-zstd.d.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/spec-node/devContainersSpecCLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const mountRegex = /^type=(bind|volume),source=([^,]+),target=([^,]+)(?:,externa
// Disable this to allow `--no-cache` on the `build` command to align with `docker build` syntax
'boolean-negation': false,
'halt-at-non-option': restArgs,
// Pass `exec` arguments on verbatim (e.g., `1.0` instead of the number 1).
'parse-positional-numbers': !restArgs,
})
.scriptName('devcontainer')
.version(version)
Expand Down
15 changes: 11 additions & 4 deletions src/spec-node/dockerCompose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ import { randomUUID } from 'crypto';
const projectLabel = 'com.docker.compose.project';
const serviceLabel = 'com.docker.compose.service';

// js-yaml 5 loads YAML 1.2 without merge keys (`<<`) by default, Compose supports them.
const composeYamlSchema = yaml.CORE_SCHEMA.withTags(yaml.mergeTag);

function loadComposeYaml(text: string): any {
return yaml.load(text, { schema: composeYamlSchema });
}

export async function openDockerComposeDevContainer(params: DockerResolverParameters, workspace: Workspace, config: SubstitutedConfig<DevContainerFromDockerComposeConfig>, idLabels: string[], additionalFeatures: Record<string, string | boolean | Record<string, string | boolean>>): Promise<ResolverResult> {
const { common, dockerCLI, dockerComposeCLI } = params;
const { cliHost, env, output } = common;
Expand Down Expand Up @@ -591,7 +598,7 @@ export async function readDockerComposeConfig(params: DockerCLIParameters, compo
}, ...composeGlobalArgs, 'config');
const stdoutStr = stdout.toString();
params.output.write(stdoutStr);
return yaml.load(stdoutStr) || {} as any;
return loadComposeYaml(stdoutStr) || {};
} catch (err) {
if (!Buffer.isBuffer(err?.stderr) || err?.stderr.toString().indexOf('UnicodeEncodeError') === -1) {
throw err;
Expand All @@ -608,7 +615,7 @@ export async function readDockerComposeConfig(params: DockerCLIParameters, compo
},
}, LogLevel.Info),
}, ...composeGlobalArgs, 'config');
return yaml.load(cmdOutput.replace(terminalEscapeSequences, '')) || {} as any;
return loadComposeYaml(cmdOutput.replace(terminalEscapeSequences, '')) || {};
}
const { stdout } = await dockerComposeCLI({
...params,
Expand All @@ -620,7 +627,7 @@ export async function readDockerComposeConfig(params: DockerCLIParameters, compo
}, ...composeGlobalArgs, 'config');
const stdoutStr = stdout.toString();
params.output.write(stdoutStr);
return yaml.load(stdoutStr) || {} as any;
return loadComposeYaml(stdoutStr) || {};
}
} catch (err) {
throw err instanceof ContainerError ? err : new ContainerError({ description: 'An error occurred retrieving the Docker Compose configuration.', originalError: err, data: { fileWithError: composeFiles[0] } });
Expand Down Expand Up @@ -663,7 +670,7 @@ export async function getProjectName(params: DockerCLIParameters | DockerResolve
// Check if 'devcontainer' is from a compose file or just the default.
for (let i = composeFiles.length - 1; i >= 0; i--) {
try {
const fragment = yaml.load((await cliHost.readFile(composeFiles[i])).toString()) || {} as any;
const fragment = loadComposeYaml((await cliHost.readFile(composeFiles[i])).toString()) || {};
if (fragment.name) {
// Use composeConfig.name ('devcontainer') because fragment.name could include environment variables.
return toProjectName(composeConfig.name, newProjectName);
Expand Down
6 changes: 0 additions & 6 deletions src/spec-node/typings/zlib-zstd.d.ts

This file was deleted.

6 changes: 6 additions & 0 deletions src/test/cli.exec.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export function describeTests1({ text, options }: BuildKitOption) {
assert.equal(res.signal, undefined);
assert.strictEqual(res.stdout.toString(), 'hi\n');
});
it('should pass along numeric arguments verbatim', async () => {
const res = await shellBufferExec(`${cli} exec --workspace-folder ${testFolder} echo 1.0 007 0x10`);
assert.strictEqual(res.code, 0);
assert.equal(res.signal, undefined);
assert.strictEqual(res.stdout.toString(), '1.0 007 0x10\n');
});
it('should not run in a terminal', async () => {
const res = await shellBufferExec(`${cli} exec --workspace-folder ${testFolder} [ ! -t 1 ]`);
assert.strictEqual(res.code, 0);
Expand Down
Loading
Loading