Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make node 18 the default #4325

Merged
merged 3 commits into from
Nov 13, 2023
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jobs:
fail-fast: false
matrix:
debian:
- 'buster' # 10
node: ['16', '18', '20']
- 'buster' # 10
node: ['18', '20']
include:
- debian: 'bullseye' # 11
node: '20'
- debian: 'bookworm' #12
node: '20'
env:
# Node version whose images will be aliased without the -nodeXX segment
DEFAULT_NODE_MAJOR_VERSION: 16
DEFAULT_NODE_MAJOR_VERSION: 18
steps:
- name: Check out
uses: actions/checkout@v4
Expand Down
38 changes: 15 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
with:
distribution: 'zulu'
java-version: '8'
- name: Set up Node 16
- name: Set up Node 18
uses: actions/setup-node@v4
with:
cache: yarn
node-version: '16'
node-version: '18'
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -125,11 +125,11 @@ jobs:
with:
distribution: 'zulu'
java-version: '8'
- name: Set up Node 16
- name: Set up Node 18
uses: actions/setup-node@v4
with:
cache: yarn
node-version: '16'
node-version: '18'
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -195,35 +195,28 @@ jobs:
dotnet: ['6.0.x']
go: ['1.18']
java: ['8']
node: ['16'] # EOL 2023-09-11
node: ['18'] # EOL 2025-04-30
os: [ubuntu-latest]
python: ['3.7']
# Add specific combinations to be tested against "node 14" (to restrict cardinality)
# Add specific combinations to be tested against (to restrict cardinality)
include:
# Test using Windows
- title: 'Windows'
os: windows-latest
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '16'
node: '18'
python: '3.7'
# Test using macOS
- title: 'macOS'
os: macos-latest
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '16'
node: '18'
python: '3.7'
# Test alternate Nodes
- title: 'Node 16'
java: '8'
dotnet: '6.0.x'
go: '1.18'
node: '16' # EOL 2023-09-11
os: ubuntu-latest
python: '3.7'
- title: 'Node 18'
java: '8'
dotnet: '6.0.x'
Expand All @@ -243,23 +236,23 @@ jobs:
java: '8'
dotnet: '7.0.x'
go: '1.18'
node: '16'
node: '18'
os: ubuntu-latest
python: '3.7'
# Test alternate Gos
- title: 'Go 1.19'
java: '8'
dotnet: '6.0.x'
go: '1.19'
node: '16'
node: '18'
os: ubuntu-latest
python: '3.7'
# Test alternate Javas
- title: 'Java 11'
java: '11'
dotnet: '6.0.x'
go: '1.18'
node: '16'
node: '18'
os: ubuntu-latest
python: '3.7'
# Test alternate Pythons
Expand All @@ -268,28 +261,28 @@ jobs:
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '16'
node: '18'
os: ubuntu-latest
- title: 'Python 3.9'
python: '3.9'
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '16'
node: '18'
os: ubuntu-latest
- title: 'Python 3.10'
python: '3.10'
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '16'
node: '18'
os: ubuntu-latest
- title: 'Python 3.11'
python: '3.11'
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '16'
node: '18'
os: ubuntu-latest

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -479,4 +472,3 @@ jobs:
with:
name: integtest_aws-cdk-lib
path: ./node_modules/aws-cdk-lib/dist/

7 changes: 4 additions & 3 deletions packages/@jsii/check-node/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ export class NodeRelease {
endOfLife: new Date('2022-04-30'),
supportedRange: '^12.7.0',
}),
new NodeRelease(19, { endOfLife: new Date('2023-06-01') }),

// Currently active releases (as of last edit to this file...)
new NodeRelease(16, {
endOfLife: new Date('2023-09-11'),
supportedRange: '^16.3.0',
Expand All @@ -46,8 +43,12 @@ export class NodeRelease {
endOfLife: new Date('2022-06-01'),
supportedRange: '^17.3.0',
}),
new NodeRelease(19, { endOfLife: new Date('2023-06-01') }),

// Currently active releases (as of last edit to this file...)
new NodeRelease(18, { endOfLife: new Date('2025-04-30') }),
new NodeRelease(20, { endOfLife: new Date('2026-04-30') }),
new NodeRelease(21, { endOfLife: new Date('2024-06-01') }),

// Future (planned releases)
];
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/check-node/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('tested node releases are correctly registered & supported', () => {

// This test is there to ensure house-keeping happens when it should. If we are
// testing a given node release, it must not have been EOL for over 60 days.
test(`tested node release (${process.version}) has not ben EOL for more than 60 days`, () => {
test(`tested node release (${process.version}) has not been EOL for more than 60 days`, () => {
const { nodeRelease } = NodeRelease.forThisRuntime();
expect(nodeRelease?.endOfLifeDate?.getTime()).toBeGreaterThan(
Date.now() - 60 * 86_400_000,
Expand Down
7 changes: 4 additions & 3 deletions packages/@jsii/check-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ export function checkNode(envPrefix = 'JSII'): void {

if (nodeRelease?.endOfLife) {
const silenceVariable = `${envPrefix}_SILENCE_WARNING_END_OF_LIFE_NODE_VERSION`;
const acknowledgeNodeEol =
'Node14 is now end of life (EOL) as of April 30, 2023. Support of EOL runtimes are only guaranteed for 30 days after EOL. By silencing this warning you acknowledge that you are using an EOL version of Node and will upgrade to a supported version as soon as possible.';
const silencedVersions = (process.env[silenceVariable] ?? '')
.split(',')
.map((v) => v.trim());
Comment on lines -25 to +27
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation was very verbose and used a "nanny" approach. In reality we need this check only to silence warnings in tests. It did also not account for different versions.

Re-implemented this to require ack of every specific node version.

const qualifier = nodeRelease.endOfLifeDate
? ` on ${nodeRelease.endOfLifeDate.toISOString().slice(0, 10)}`
: '';
if (!(process.env[silenceVariable] === acknowledgeNodeEol))
if (!silencedVersions.includes(nodeRelease.majorVersion.toString()))
veryVisibleMessage(
bgRed.white.bold,
`Node ${nodeRelease.majorVersion} has reached end-of-life${qualifier} and is not supported.`,
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/python-runtime/tests/test_invoke_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def silence_node_deprecation_warnings():
for var in variables:
environ[var] = "1"

nodeEolAcknowledgement = "Node14 is now end of life (EOL) as of April 30, 2023. Support of EOL runtimes are only guaranteed for 30 days after EOL. By silencing this warning you acknowledge that you are using an EOL version of Node and will upgrade to a supported version as soon as possible."
environ["JSII_SILENCE_WARNING_END_OF_LIFE_NODE_VERSION"] = nodeEolAcknowledgement
# silence this for the next decades
environ["JSII_SILENCE_WARNING_END_OF_LIFE_NODE_VERSION"] = "14,16,18,20,22,24,26,28,30,32,34"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should never fail because of an outdated node version.
We have other mechanisms to check this.


# Execute the test
yield
Expand Down
58 changes: 29 additions & 29 deletions superchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ARG DEBIAN_VERSION="bookworm"

# We require a couple of tools to be available in order to work here...
RUN echo "deb http://deb.debian.org/debian ${DEBIAN_VERSION}-backports main" \
> "/etc/apt/sources.list.d/${DEBIAN_VERSION}-backports.list" \
> "/etc/apt/sources.list.d/${DEBIAN_VERSION}-backports.list" \
&& apt-get update \
&& apt-get install -y gpg tar zsh \
# We need a "recent" (>= 7.71) version of curl for --retry-all-errors, so we get it from backports...
Expand All @@ -54,9 +54,9 @@ ARG M2_VERSION="3.9.4"
ENV M2_DISTRO="https://www.apache.org/dist/maven/maven-3"
RUN set -eo pipefail \
&& curl -fSsL "${M2_DISTRO}/${M2_VERSION}/binaries/apache-maven-${M2_VERSION}-bin.tar.gz" \
-o /tmp/apache-maven.tar.gz \
-o /tmp/apache-maven.tar.gz \
&& curl -fSsL "${M2_DISTRO}/${M2_VERSION}/binaries/apache-maven-${M2_VERSION}-bin.tar.gz.asc" \
-o /tmp/apache-maven.tar.gz.asc \
-o /tmp/apache-maven.tar.gz.asc \
&& mkdir -p /tmp/gpg-maven && chmod go-rwx /tmp/gpg-maven \
&& curl -fSsL "https://www.apache.org/dist/maven/KEYS" | gpg --homedir /tmp/gpg-maven --import \
&& gpg --homedir /tmp/gpg-maven --verify /tmp/apache-maven.tar.gz.asc /tmp/apache-maven.tar.gz \
Expand All @@ -75,11 +75,11 @@ RUN DOTNET_VERSION=$(curl -fSsL "${DOTNET_FEED}/Sdk/${DOTNET_CHANNEL}/latest.ver
# Prepare PowerShell LTS distribution
ENV POWERSHELL_RELEASES="https://github.com/PowerShell/PowerShell/releases"
RUN POWERSHELL_RELEASE=$(curl -X GET -fSsIL "https://aka.ms/powershell-release?tag=lts" -o /dev/null \
--retry 5 --retry-all-errors -w %{url_effective}) \
--retry 5 --retry-all-errors -w %{url_effective}) \
&& POWERSHELL_VERSION=${POWERSHELL_RELEASE#${POWERSHELL_RELEASES}/tag/v} \
&& ASSET="powershell-${POWERSHELL_VERSION}-linux-${${TARGETPLATFORM#linux/}/amd64/x64}.tar.gz" \
&& curl -fSsL "${POWERSHELL_RELEASES}/download/v${POWERSHELL_VERSION}/${ASSET}" --retry 5 --retry-all-errors \
-o /tmp/powershell.tar.gz \
-o /tmp/powershell.tar.gz \
&& mkdir -p /opt/microsoft/powershell \
&& tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell \
&& chmod +x /opt/microsoft/powershell/pwsh
Expand Down Expand Up @@ -125,32 +125,32 @@ ENV LANG="C.UTF-8"
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
curl \
dirmngr \
git \
gnupg \
gzip \
libffi-dev \
libicu-dev \
libssl-dev \
openssh-client \
openssl \
rsync \
sudo \
unzip \
zip \
acl \
apt-transport-https \
build-essential \
ca-certificates \
curl \
dirmngr \
git \
gnupg \
gzip \
libffi-dev \
libicu-dev \
libssl-dev \
openssh-client \
openssl \
rsync \
sudo \
unzip \
zip \
acl \
&& rm -rf /var/lib/apt/lists/*

# Install mono
COPY superchain/gpg/mono.asc /tmp/mono.asc
RUN apt-key add /tmp/mono.asc && rm /tmp/mono.asc \
# Mono only provides a Debian Buster (10) distribution point, but it works with subsequent debians, too...
&& echo "deb https://download.mono-project.com/repo/debian stable-buster main" \
> /etc/apt/sources.list.d/mono-official-stable.list \
> /etc/apt/sources.list.d/mono-official-stable.list \
&& apt-get update \
&& apt-get -y install mono-devel \
&& rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -213,7 +213,7 @@ ARG GITHUB_CLI_VERSION="1.13.1"
RUN BASE="https://github.com/cli/cli/releases/download" \
&& echo "${BASE}/v${GITHUB_CLI_VERSION}/gh_${GITHUB_CLI_VERSION}_linux_${TARGETPLATFORM#linux/}.deb" \
&& curl -fSsL "${BASE}/v${GITHUB_CLI_VERSION}/gh_${GITHUB_CLI_VERSION}_linux_${TARGETPLATFORM#linux/}.deb" \
-o /tmp/gh.deb \
-o /tmp/gh.deb \
&& apt-get update \
&& apt-get -y install /tmp/gh.deb \
&& rm /tmp/gh.deb \
Expand All @@ -232,15 +232,15 @@ COPY superchain/m2-settings.xml /root/.m2/settings.xml
# Install Go
COPY --from=bindist /opt/golang/go ${GOROOT}

# Install Node 14+ (configurable with '--build-arg NODE_MAJOR_VERSION=xxx') and yarn
# Install Node (configurable with '--build-arg NODE_MAJOR_VERSION=xxx') and yarn
# (Put this as late as possible in the Dockerfile so we get to reuse the layer cache
# for most of the multiple builds).
ARG NODE_MAJOR_VERSION="16"
ARG NODE_MAJOR_VERSION="18"
COPY superchain/gpg/nodesource.asc /tmp/nodesource.asc
COPY superchain/gpg/yarn.asc /tmp/yarn.asc
RUN apt-key add /tmp/nodesource.asc && rm /tmp/nodesource.asc \
&& echo "deb https://deb.nodesource.com/node_${NODE_MAJOR_VERSION}.x ${DEBIAN_VERSION} main" \
> /etc/apt/sources.list.d/nodesource.list \
> /etc/apt/sources.list.d/nodesource.list \
# Reduce priority of the "standard" nodejs package, so that the one from nodesource is always preferred...
&& echo "Package: nodejs" > /etc/apt/preferences.d/nodejs \
&& echo 'Pin: origin "deb.debian.org"' >> /etc/apt/preferences.d/nodejs \
Expand All @@ -256,7 +256,7 @@ RUN apt-key add /tmp/nodesource.asc && rm /tmp/nodesource.asc
RUN apt-get update \
&& apt-get -y install --no-install-recommends curl \
&& curl -fSsL "https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_${TARGETPLATFORM#linux/}/amazon-ssm-agent.deb"\
-o /tmp/amazon-ssm-agent.deb \
-o /tmp/amazon-ssm-agent.deb \
&& dpkg -i /tmp/amazon-ssm-agent.deb \
&& systemctl enable amazon-ssm-agent \
&& rm -rf /var/lib/apt/lists/*
Expand Down
Loading
Loading