Skip to content

Commit

Permalink
refactor!: Drop support for deprecated runtimes (aws#1967)
Browse files Browse the repository at this point in the history
* refactor!: Drop support for deprecated runtimes

The following runtimes have been deprecated by AWS Lambda and are being removed from
build, init, and invoke|start-api|start-lambda commands:
  - dotnetcore1.0
  - dotnetcore2.0
  - nodejs4.3
  - nodejs6.10
  - nodejs8.10

* Remove nodejs runtime which is not even a valid runtime

* Format with black

Co-authored-by: Jacob Fuss <[email protected]>
Co-authored-by: Sriram Madapusi Vasudevan <[email protected]>
  • Loading branch information
3 people authored May 7, 2020
1 parent da9f5bd commit 972fa19
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 158 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
{%- if cookiecutter.runtime == 'dotnetcore2.0' %}
<TargetFramework>netcoreapp2.0</TargetFramework>
{%- elif cookiecutter.runtime == 'dotnetcore2.1' %}
{%- if cookiecutter.runtime == 'dotnetcore2.1' %}
<TargetFramework>netcoreapp2.1</TargetFramework>
{%- else %}
<TargetFramework>netcoreapp3.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"profile":"",
"region" : "",
"configuration": "Release",
{%- if cookiecutter.runtime == 'dotnetcore2.0' %}
"framework": "netcoreapp2.0",
{%- elif cookiecutter.runtime == 'dotnetcore2.1' %}
{%- if cookiecutter.runtime == 'dotnetcore2.1' %}
"framework": "netcoreapp2.1",
{%- else %}
"framework" : "netcoreapp3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ Resources:
Properties:
CodeUri: ./src/HelloWorld/
Handler: HelloWorld::HelloWorld.Function::FunctionHandler
{%- if cookiecutter.runtime == 'dotnetcore2.0' %}
Runtime: {{ cookiecutter.runtime }}
{%- elif cookiecutter.runtime == 'dotnetcore2.1' %}
{%- if cookiecutter.runtime == 'dotnetcore2.1' %}
Runtime: {{ cookiecutter.runtime }}
{%- else %}
Runtime: dotnetcore3.1
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 @@ -38,7 +38,7 @@
],
"dotnet": [
{
"runtimes": ["dotnetcore3.1", "dotnetcore2.1", "dotnetcore2.0", "dotnetcore1.0"],
"runtimes": ["dotnetcore3.1", "dotnetcore2.1"],
"dependency_manager": "cli-package",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-dotnet"),
"build": True,
Expand Down Expand Up @@ -79,8 +79,6 @@
"nodejs10.x": ["npm"],
"dotnetcore3.1": ["cli-package"],
"dotnetcore2.1": ["cli-package"],
"dotnetcore2.0": ["cli-package"],
"dotnetcore1.0": ["cli-package"],
"go1.x": ["mod"],
"java8": ["maven", "gradle"],
"java11": ["maven", "gradle"],
Expand Down Expand Up @@ -118,8 +116,6 @@
"java8",
# older dotnetcore runtimes
"dotnetcore2.1",
"dotnetcore2.0",
"dotnetcore1.0",
]

# Schemas Code lang is a MINIMUM supported version - this is why later Lambda runtimes can be mapped to earlier Schemas Code Languages
Expand Down
63 changes: 0 additions & 63 deletions samcli/local/docker/lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ def get_debug_settings(debug_port, debug_args_list, runtime, options):
+ " ".join(debug_args_list)
},
),
Runtime.dotnetcore20.value: DebugSettings(
["/var/lang/bin/dotnet"]
+ debug_args_list
+ ["/var/runtime/MockBootstraps.dll", "--debugger-spin-wait"],
debug_env_vars={},
),
Runtime.dotnetcore21.value: DebugSettings(
["/var/lang/bin/dotnet"]
+ debug_args_list
Expand All @@ -82,63 +76,6 @@ def get_debug_settings(debug_port, debug_args_list, runtime, options):
+ ["-debug=true", "-delvePort=" + str(debug_port), "-delvePath=" + options.get("delvePath")],
debug_env_vars={},
),
Runtime.nodejs.value: DebugSettings(
["/usr/bin/node"]
+ debug_args_list
+ [
"--debug-brk=" + str(debug_port),
"--nolazy",
"--max-old-space-size=1229",
"--max-new-space-size=153",
"--max-executable-size=153",
"--expose-gc",
"/var/runtime/node_modules/awslambda/bin/awslambda",
],
debug_env_vars={},
),
Runtime.nodejs43.value: DebugSettings(
["/usr/local/lib64/node-v4.3.x/bin/node"]
+ debug_args_list
+ [
"--debug-brk=" + str(debug_port),
"--nolazy",
"--max-old-space-size=2547",
"--max-semi-space-size=150",
"--max-executable-size=160",
"--expose-gc",
"/var/runtime/node_modules/awslambda/index.js",
],
debug_env_vars={},
),
Runtime.nodejs610.value: DebugSettings(
["/var/lang/bin/node"]
+ debug_args_list
+ [
"--debug-brk=" + str(debug_port),
"--nolazy",
"--max-old-space-size=2547",
"--max-semi-space-size=150",
"--max-executable-size=160",
"--expose-gc",
"/var/runtime/node_modules/awslambda/index.js",
],
debug_env_vars={},
),
Runtime.nodejs810.value: DebugSettings(
["/var/lang/bin/node"]
+ debug_args_list
+ [
# Node8 requires the host to be explicitly set in order to bind to localhost
# instead of 127.0.0.1. https://github.com/nodejs/node/issues/11591#issuecomment-283110138
"--inspect-brk=0.0.0.0:" + str(debug_port),
"--nolazy",
"--expose-gc",
"--max-semi-space-size=150",
"--max-old-space-size=2707",
"/var/runtime/node_modules/awslambda/index.js",
],
debug_env_vars={},
),
Runtime.nodejs10x.value: DebugSettings(
[
"/var/rapid/init",
Expand Down
5 changes: 0 additions & 5 deletions samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@


class Runtime(Enum):
nodejs = "nodejs"
nodejs43 = "nodejs4.3"
nodejs610 = "nodejs6.10"
nodejs810 = "nodejs8.10"
nodejs10x = "nodejs10.x"
nodejs12x = "nodejs12.x"
python27 = "python2.7"
Expand All @@ -32,7 +28,6 @@ class Runtime(Enum):
java8 = "java8"
java11 = "java11"
go1x = "go1.x"
dotnetcore20 = "dotnetcore2.0"
dotnetcore21 = "dotnetcore2.1"
dotnetcore31 = "dotnetcore3.1"
provided = "provided"
Expand Down
10 changes: 1 addition & 9 deletions tests/integration/buildcmd/test_build_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,8 @@ class TestBuildCommand_NodeFunctions(BuildIntegBase):

@parameterized.expand(
[
("nodejs6.10", False),
("nodejs8.10", False),
("nodejs10.x", False),
("nodejs12.x", False),
("nodejs6.10", "use_container"),
("nodejs8.10", "use_container"),
("nodejs10.x", "use_container"),
("nodejs12.x", "use_container"),
]
Expand Down Expand Up @@ -457,10 +453,8 @@ class TestBuildCommand_Dotnet_cli_package(BuildIntegBase):

@parameterized.expand(
[
("dotnetcore2.0", "Dotnetcore2.0", None),
("dotnetcore2.1", "Dotnetcore2.1", None),
("dotnetcore3.1", "Dotnetcore3.1", None),
("dotnetcore2.0", "Dotnetcore2.0", "debug"),
("dotnetcore2.1", "Dotnetcore2.1", "debug"),
("dotnetcore3.1", "Dotnetcore3.1", "debug"),
]
Expand Down Expand Up @@ -514,9 +508,7 @@ def test_with_dotnetcore(self, runtime, code_uri, mode):

self.verify_docker_container_cleanedup(runtime)

@parameterized.expand(
[("dotnetcore2.0", "Dotnetcore2.0"), ("dotnetcore2.1", "Dotnetcore2.1"), ("dotnetcore3.1", "Dotnetcore3.1")]
)
@parameterized.expand([("dotnetcore2.1", "Dotnetcore2.1"), ("dotnetcore3.1", "Dotnetcore3.1")])
@pytest.mark.flaky(reruns=3)
def test_must_fail_with_container(self, runtime, code_uri):
use_container = True
Expand Down

This file was deleted.

26 changes: 0 additions & 26 deletions tests/integration/testdata/buildcmd/Dotnetcore2.0/Program.cs

This file was deleted.

This file was deleted.

7 changes: 1 addition & 6 deletions tests/unit/local/docker/test_lambda_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@

RUNTIMES_WITH_ENTRYPOINT = [
Runtime.java8.value,
Runtime.dotnetcore20.value,
Runtime.dotnetcore21.value,
Runtime.go1x.value,
Runtime.nodejs.value,
Runtime.nodejs43.value,
Runtime.nodejs610.value,
Runtime.nodejs810.value,
Runtime.python36.value,
Runtime.python27.value,
]
Expand All @@ -39,7 +34,7 @@

class TestLambdaContainer_init(TestCase):
def setUp(self):
self.runtime = "nodejs4.3"
self.runtime = "nodejs12.x"
self.handler = "handler"
self.code_dir = "codedir"
self.env_var = {"var": "value"}
Expand Down

0 comments on commit 972fa19

Please sign in to comment.