Skip to content

feat(WindowsPlatform): add option to disable Chocolatey Node.js upgrade#2033

Merged
cdklabs-automation merged 3 commits intomainfrom
iankhou-no-choco
Feb 4, 2026
Merged

feat(WindowsPlatform): add option to disable Chocolatey Node.js upgrade#2033
cdklabs-automation merged 3 commits intomainfrom
iankhou-no-choco

Conversation

@iankhou
Copy link
Copy Markdown
Contributor

@iankhou iankhou commented Feb 2, 2026

Description

In f7a7581, we introduced a step to install/update nodejs-lts, due to the Windows Server CodeBuild image relying on an old version of Node.

This step relies on https://community.chocolatey.org/api/v2/ to install node-lts, which can cause availability issues. Chocolatey's organizational development guide specifically recommends against doing this.

In addition: Even when installing Node with Chocolatey, the container will still use the Node installation it shipped with, UNLESS a developer explicitly modifies their buildspec to call refreshenv (an alias for Update-SessionEnvironment OR manually manipulates their PATH. Without taking this additional step that we do not do for you, the container will still use the default Node installation.

Regardless, Windows Server Core 2019 standard:3.0 image (made available February 7, 2024 per AWS CodeBuild history) ships with more up-to-date versions, as of writing:

  • 20.18 (default)
  • 22.13

Developers should upgrade their image version, rather than upgrading Node in the container run.

Changes

A developer who has the following code will see no change in behavior:

new delivlib.WindowsPlatform(codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0);

The image will still install Node from Chocolatey.

The following code does not install Node from Chocolatey:

new delivlib.WindowsPlatform(codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0, { upgradeNodeWithChocolatey: false });

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@iliapolo
Copy link
Copy Markdown
Contributor

iliapolo commented Feb 3, 2026

Draft until we live test this

@iliapolo iliapolo marked this pull request as draft February 3, 2026 18:12
auto-merge was automatically disabled February 3, 2026 18:12

Pull request was converted to draft

@iankhou iankhou changed the title chore: remove windows nodejs upgrade step feat: provide option for WindowsPlatform to omit chocolatey node installation Feb 3, 2026
@iankhou
Copy link
Copy Markdown
Contributor Author

iankhou commented Feb 3, 2026

Live tested. Putting it up for review again.

@iankhou iankhou marked this pull request as ready for review February 3, 2026 20:42
@iankhou iankhou requested a review from Copilot February 3, 2026 20:57
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

Adds an opt-out to the Windows CodeBuild platform setup so consumers can skip upgrading/installing Node.js via Chocolatey (to avoid external dependency/availability concerns).

Changes:

  • Introduces a WindowsPlatform constructor parameter to control whether Node is upgraded via Chocolatey (default remains enabled).
  • Skips emitting Windows install phase commands when Chocolatey-based Node upgrade is disabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/shellable.ts
Comment thread lib/shellable.ts Outdated
Add WindowsPlatformOptions interface with upgradeNodeWithChocolatey option
(defaults to true for backward compatibility). This allows users to skip
the Chocolatey Node.js upgrade during the install phase.
@iankhou iankhou changed the title feat: provide option for WindowsPlatform to omit chocolatey node installation feat(WindowsPlatform): add option to disable Chocolatey Node.js upgrade Feb 4, 2026
@iankhou iankhou requested a review from Copilot February 4, 2026 16:51
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/shellable.ts
@cdklabs-automation cdklabs-automation added this pull request to the merge queue Feb 4, 2026
Merged via the queue into main with commit 3ca600b Feb 4, 2026
14 checks passed
@cdklabs-automation cdklabs-automation deleted the iankhou-no-choco branch February 4, 2026 20:44
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.

4 participants