Skip to content

Commit

Permalink
chore: Deprecate Nodejs12 and Nodejs14 (#6664)
Browse files Browse the repository at this point in the history
* chore: Deprecate Nodejs12 and Nodejs14

* Make Windows container tests Node18
  • Loading branch information
mildaniel authored Feb 8, 2024
1 parent fefee10 commit 0650293
Show file tree
Hide file tree
Showing 35 changed files with 181 additions and 233 deletions.
2 changes: 1 addition & 1 deletion designs/build_for_provided_runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ What will be changed?
---------------------

Serverless Function resources can now have a Metadata Resource Attribute which specifies a `BuildMethod`.
`BuildMethod` will either be the official lambda runtime identifiers such as `python3.8`, `nodejs12.x` etc or `makefile`.
`BuildMethod` will either be the official lambda runtime identifiers such as `python3.8`, `nodejs20.x` etc or `makefile`.
If `BuildMethod` is specified to be `makefile`, the build targets that are present in the `Makefile` which take the form of

`build-{resource_logical_id}` will be executed.
Expand Down
3 changes: 1 addition & 2 deletions samcli/commands/_utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@

_TEMPLATE_OPTION_DEFAULT_VALUE = "template.[yaml|yml|json]"
SUPPORTED_BUILD_IN_SOURCE_WORKFLOWS = [
Runtime.nodejs12x.value,
Runtime.nodejs14x.value,
Runtime.nodejs16x.value,
Runtime.nodejs18x.value,
Runtime.nodejs20x.value,
"Makefile",
"esbuild",
]
Expand Down
4 changes: 2 additions & 2 deletions samcli/commands/local/cli_common/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def local_common_options(f):
multiple=True,
help="Container image URIs for invoking functions or starting api and function. "
"One can specify the image URI used for the local function invocation "
"(--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). "
"(--invoke-image public.ecr.aws/sam/build-nodejs20.x:latest). "
"One can also specify for each individual function with "
"(--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). "
"(--invoke-image Function1=public.ecr.aws/sam/build-nodejs20.x:latest). "
"If a function does not have invoke image specified, the default AWS SAM CLI "
"emulation image will be used.",
),
Expand Down
6 changes: 1 addition & 5 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ def get_layer_subfolder(build_workflow: str) -> str:
"nodejs4.3": "nodejs",
"nodejs6.10": "nodejs",
"nodejs8.10": "nodejs",
"nodejs12.x": "nodejs",
"nodejs14.x": "nodejs",
"nodejs16.x": "nodejs",
"nodejs18.x": "nodejs",
"nodejs20.x": "nodejs",
Expand Down Expand Up @@ -139,7 +137,7 @@ def get_workflow_config(
specified_workflow str
Workflow to be used, if directly specified. They are currently scoped to "makefile" and the official runtime
identifier names themselves, eg: nodejs14.x. If a workflow is not directly specified,
identifier names themselves, eg: nodejs20.x. If a workflow is not directly specified,
it is calculated by the current method based on the runtime.
Returns
Expand All @@ -161,8 +159,6 @@ def get_workflow_config(
"python3.10": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.11": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.12": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"nodejs12.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs14.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs16.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs18.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs20.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
Expand Down
14 changes: 12 additions & 2 deletions samcli/lib/init/local_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"useCaseName": "Hello World Example"
}
],
"nodejs14.x": [
"nodejs20.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
Expand All @@ -83,7 +83,17 @@
"useCaseName": "Hello World Example"
}
],
"nodejs12.x": [
"nodejs18.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
"dependencyManager": "npm",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
],
"nodejs16.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"project_name": "Name of the project",
"runtime": "nodejs12.x",
"runtime": "nodejs20.x",
"architectures": {
"value": [
"x86_64"
Expand Down
2 changes: 0 additions & 2 deletions samcli/lib/utils/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
ARM64 = "arm64"

SUPPORTED_RUNTIMES: Dict[str, List[str]] = {
"nodejs12.x": [ARM64, X86_64],
"nodejs14.x": [ARM64, X86_64],
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
Expand Down
6 changes: 1 addition & 5 deletions samcli/local/common/runtime_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"nodejs": [
{
"runtimes": ["nodejs20.x", "nodejs18.x", "nodejs16.x", "nodejs14.x", "nodejs12.x"],
"runtimes": ["nodejs20.x", "nodejs18.x", "nodejs16.x"],
"dependency_manager": "npm",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"),
"build": True,
Expand Down Expand Up @@ -111,8 +111,6 @@ def get_local_lambda_images_location(mapping, runtime):
"nodejs20.x",
"nodejs18.x",
"nodejs16.x",
"nodejs14.x",
"nodejs12.x",
# custom runtime in descending order
"provided.al2023",
"provided.al2",
Expand Down Expand Up @@ -143,8 +141,6 @@ def get_local_lambda_images_location(mapping, runtime):
"nodejs20.x": "amazon/nodejs20.x-base",
"nodejs18.x": "amazon/nodejs18.x-base",
"nodejs16.x": "amazon/nodejs16.x-base",
"nodejs14.x": "amazon/nodejs14.x-base",
"nodejs12.x": "amazon/nodejs12.x-base",
"python3.12": "amazon/python3.12-base",
"python3.11": "amazon/python3.11-base",
"python3.10": "amazon/python3.10-base",
Expand Down
28 changes: 0 additions & 28 deletions samcli/local/docker/lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,34 +117,6 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.nodejs12x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
+ debug_args_list
+ ["--no-lazy", "--expose-gc"]
+ ["/var/runtime/index.js"],
container_env_vars={
"NODE_PATH": "/opt/nodejs/node_modules:/opt/nodejs/node12/node_modules:/var/runtime/node_modules:"
"/var/runtime:/var/task",
"NODE_OPTIONS": f"--inspect-brk=0.0.0.0:{str(debug_port)} --max-http-header-size 81920",
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs12.x",
**_container_env_vars,
},
),
Runtime.nodejs14x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
+ debug_args_list
+ ["--no-lazy", "--expose-gc"]
+ ["/var/runtime/index.js"],
container_env_vars={
"NODE_PATH": "/opt/nodejs/node_modules:/opt/nodejs/node14/node_modules:/var/runtime/node_modules:"
"/var/runtime:/var/task",
"NODE_OPTIONS": f"--inspect-brk=0.0.0.0:{str(debug_port)} --max-http-header-size 81920",
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs14.x",
**_container_env_vars,
},
),
Runtime.nodejs16x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
Expand Down
4 changes: 1 addition & 3 deletions samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@


class Runtime(Enum):
nodejs12x = "nodejs12.x"
nodejs14x = "nodejs14.x"
nodejs16x = "nodejs16.x"
nodejs18x = "nodejs18.x"
nodejs20x = "nodejs20.x"
Expand Down Expand Up @@ -97,7 +95,7 @@ def get_image_name_tag(cls, runtime: str, architecture: str) -> str:
else:
# This fits most runtimes format: `nameN.M` becomes `name:N.M` (python3.9 -> python:3.9)
runtime_image_tag = re.sub(r"^([a-z]+)([0-9][a-z0-9\.]*)$", r"\1:\2", runtime)
# nodejs14.x, go1.x, etc don't have the `.x` part.
# nodejs20.x, go1.x, etc don't have the `.x` part.
runtime_image_tag = runtime_image_tag.replace(".x", "")

# Runtime image tags contain the architecture only if more than one is supported for that runtime
Expand Down
30 changes: 13 additions & 17 deletions schema/samcli.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Resources:
Properties:
PackageType: Image
Metadata:
DockerTag: nodejs14.x-v1
DockerTag: nodejs20.x-v1
DockerContext: ./hello-world
Dockerfile: Dockerfile
34 changes: 13 additions & 21 deletions tests/integration/buildcmd/test_build_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,9 @@ def test_unsupported_runtime(self):
class TestBuildCommand_NodeFunctions(BuildIntegNodeBase):
@parameterized.expand(
[
("nodejs12.x", False),
("nodejs14.x", False),
("nodejs16.x", False),
("nodejs18.x", False),
("nodejs20.x", False),
("nodejs12.x", "use_container"),
("nodejs14.x", "use_container"),
("nodejs16.x", "use_container"),
("nodejs18.x", "use_container"),
("nodejs20.x", "use_container"),
Expand All @@ -687,7 +683,6 @@ class TestBuildCommand_NodeFunctions_With_External_Manifest(BuildIntegNodeBase):

@parameterized.expand(
[
("nodejs14.x",),
("nodejs16.x",),
("nodejs18.x",),
("nodejs20.x",),
Expand All @@ -702,11 +697,12 @@ class TestBuildCommand_EsbuildFunctions(BuildIntegEsbuildBase):

@parameterized.expand(
[
("nodejs14.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False, "x86_64"),
("nodejs14.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False, "x86_64"),
("nodejs14.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", "use_container", "x86_64"),
("nodejs20.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False, "x86_64"),
("nodejs20.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False, "x86_64"),
# Keeping container tests as Node.js18 until our CI platform can run Node.js20 container tests
("nodejs18.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", "use_container", "x86_64"),
(
"nodejs14.x",
"nodejs18.x",
"Esbuild/TypeScript",
{"app.js", "app.js.map"},
"app.lambdaHandler",
Expand All @@ -728,15 +724,15 @@ class TestBuildCommand_EsbuildFunctions_With_External_Manifest(BuildIntegEsbuild
@parameterized.expand(
[
(
"nodejs14.x",
"nodejs20.x",
"Esbuild/Node_without_manifest",
{"main.js", "main.js.map"},
"main.lambdaHandler",
False,
"x86_64",
),
(
"nodejs14.x",
"nodejs20.x",
"Esbuild/TypeScript_without_manifest",
{"app.js", "app.js.map"},
"app.lambdaHandler",
Expand Down Expand Up @@ -788,13 +784,9 @@ class TestBuildCommand_NodeFunctions_With_Specified_Architecture(BuildIntegNodeB

@parameterized.expand(
[
("nodejs12.x", False, "x86_64"),
("nodejs14.x", False, "x86_64"),
("nodejs16.x", False, "x86_64"),
("nodejs18.x", False, "x86_64"),
("nodejs20.x", False, "x86_64"),
("nodejs12.x", "use_container", "x86_64"),
("nodejs14.x", "use_container", "x86_64"),
("nodejs16.x", "use_container", "x86_64"),
("nodejs18.x", "use_container", "x86_64"),
]
Expand Down Expand Up @@ -2136,12 +2128,12 @@ class TestBuildWithDedupBuilds(DedupBuildIntegBase):
"dotnet6",
),
(False, "Java/gradlew/8", "aws.example.Hello::myHandler", "aws.example.SecondFunction::myHandler", "java8"),
(False, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs14.x"),
(False, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs20.x"),
(False, "Python", "main.first_function_handler", "main.second_function_handler", "python3.9"),
(False, "Ruby", "app.lambda_handler", "app.second_lambda_handler", "ruby2.7"),
# container
(True, "Java/gradlew/8", "aws.example.Hello::myHandler", "aws.example.SecondFunction::myHandler", "java8"),
(True, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs14.x"),
(True, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs20.x"),
(True, "Python", "main.first_function_handler", "main.second_function_handler", "python3.9"),
(True, "Ruby", "app.lambda_handler", "app.second_lambda_handler", "ruby2.7"),
]
Expand Down Expand Up @@ -2255,12 +2247,12 @@ class TestBuildWithCacheBuilds(CachedBuildIntegBase):
"dotnet6",
),
(False, "Java/gradlew/8", "aws.example.Hello::myHandler", "aws.example.SecondFunction::myHandler", "java8"),
(False, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs14.x"),
(False, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs20.x"),
(False, "Python", "main.first_function_handler", "main.second_function_handler", "python3.9"),
(False, "Ruby", "app.lambda_handler", "app.second_lambda_handler", "ruby2.7"),
# container
(True, "Java/gradlew/8", "aws.example.Hello::myHandler", "aws.example.SecondFunction::myHandler", "java8"),
(True, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs14.x"),
(True, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs20.x"),
(True, "Python", "main.first_function_handler", "main.second_function_handler", "python3.9"),
(True, "Ruby", "app.lambda_handler", "app.second_lambda_handler", "ruby2.7"),
]
Expand Down Expand Up @@ -2434,12 +2426,12 @@ class TestParallelBuilds(DedupBuildIntegBase):
"dotnet6",
),
(False, "Java/gradlew/8", "aws.example.Hello::myHandler", "aws.example.SecondFunction::myHandler", "java8"),
(False, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs14.x"),
(False, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs20.x"),
(False, "Python", "main.first_function_handler", "main.second_function_handler", "python3.9"),
(False, "Ruby", "app.lambda_handler", "app.second_lambda_handler", "ruby2.7"),
# container
(True, "Java/gradlew/8", "aws.example.Hello::myHandler", "aws.example.SecondFunction::myHandler", "java8"),
(True, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs14.x"),
(True, "Node", "main.lambdaHandler", "main.secondLambdaHandler", "nodejs20.x"),
(True, "Python", "main.first_function_handler", "main.second_function_handler", "python3.9"),
(True, "Ruby", "app.lambda_handler", "app.second_lambda_handler", "ruby2.7"),
]
Expand Down
12 changes: 4 additions & 8 deletions tests/integration/buildcmd/test_build_cmd_arm64.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class TestBuildCommand_EsbuildFunctions_arm64(BuildIntegEsbuildBase):

@parameterized.expand(
[
("nodejs12.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False),
("nodejs12.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False),
("nodejs12.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", "use_container"),
("nodejs20.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False),
("nodejs20.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False),
("nodejs20.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", "use_container"),
(
"nodejs12.x",
"nodejs20.x",
"Esbuild/TypeScript",
{"app.js", "app.js.map"},
"app.lambdaHandler",
Expand Down Expand Up @@ -137,13 +137,9 @@ class TestBuildCommand_NodeFunctions_With_Specified_Architecture_arm64(BuildInte

@parameterized.expand(
[
("nodejs12.x", False),
("nodejs14.x", False),
("nodejs16.x", False),
("nodejs18.x", False),
("nodejs20.x", False),
("nodejs12.x", "use_container"),
("nodejs14.x", "use_container"),
("nodejs16.x", "use_container"),
("nodejs18.x", "use_container"),
("nodejs20.x", "use_container"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Properties": {
"CodeUri": "hello-world/",
"Handler": "app.lambdaHandler",
"Runtime": "nodejs14.x"
"Runtime": "nodejs20.x"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Properties": {
"CodeUri": "hello-world/",
"Handler": "app.lambdaHandler",
"Runtime": "nodejs14.x"
"Runtime": "nodejs20.x"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Resources:
Properties:
CodeUri: HelloWorldFunction
Handler: app.lambdaHandler
Runtime: nodejs14.x
Runtime: nodejs20.x
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Properties": {
"CodeUri": "hello-world/",
"Handler": "app.lambdaHandler",
"Runtime": "nodejs14.x"
"Runtime": "nodejs20.x"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/integration/validate/test_validate_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def test_lint_supported_runtimes(self):
"java11",
"java8",
"java8.al2",
"nodejs14.x",
"nodejs16.x",
"nodejs18.x",
"nodejs20.x",
Expand Down
Loading

0 comments on commit 0650293

Please sign in to comment.