Skip to content

Commit fef06ac

Browse files
authored
Merge pull request #337 from aws/develop
chore: Merge develop into master
2 parents 00b4a46 + ca658b3 commit fef06ac

File tree

16 files changed

+83
-87
lines changed

16 files changed

+83
-87
lines changed

.appveyor.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ for:
5151
- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%"
5252
- "%PYTHON%\\python.exe -m pip install -r requirements/dev.txt"
5353
- "%PYTHON%\\python.exe -m pip install -e ."
54-
- "set PATH=C:\\Ruby25-x64\\bin;%PATH%"
5554
- "gem --version"
5655
- "gem install bundler -v 1.17.3"
5756
- "bundler --version"
@@ -76,6 +75,9 @@ for:
7675
# setup make
7776
- "choco install make"
7877

78+
# install dotnet6
79+
- ps: "&powershell -NoProfile -ExecutionPolicy unrestricted -Command \"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 6.0.200 -InstallDir 'C:\\Program Files\\dotnet\\'\""
80+
7981
# Echo final Path
8082
- "echo %PATH%"
8183

@@ -91,7 +93,6 @@ for:
9193
- sh: "JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
9294
- sh: "PATH=$JAVA_HOME/bin:$PATH"
9395
- sh: "source ${HOME}/venv${PYTHON_VERSION}/bin/activate"
94-
- sh: "rvm use 2.5"
9596
- sh: "nvm install ${nodejs_version}"
9697
- sh: "npm install [email protected] -g"
9798
- sh: "npm -v"

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
22
AWS Lambda Builder Library
33
"""
4-
__version__ = "1.12.0"
4+
__version__ = "1.13.0"
55
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/validator.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@
1111
LOG = logging.getLogger(__name__)
1212

1313
SUPPORTED_RUNTIMES = {
14-
"nodejs10.x": [X86_64],
1514
"nodejs12.x": [ARM64, X86_64],
1615
"nodejs14.x": [ARM64, X86_64],
17-
"python2.7": [X86_64],
1816
"python3.6": [X86_64],
1917
"python3.7": [X86_64],
2018
"python3.8": [ARM64, X86_64],
2119
"python3.9": [ARM64, X86_64],
22-
"ruby2.5": [X86_64],
2320
"ruby2.7": [ARM64, X86_64],
2421
"java8": [ARM64, X86_64],
2522
"java11": [ARM64, X86_64],
2623
"go1.x": [ARM64, X86_64],
27-
"dotnetcore2.1": [X86_64],
2824
"dotnetcore3.1": [ARM64, X86_64],
25+
"dotnet6": [ARM64, X86_64],
2926
"provided": [ARM64, X86_64],
3027
}
3128

aws_lambda_builders/workflows/python_pip/DESIGN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def build_dependencies(artifacts_dir_path,
4949
5050
:type runtime: str
5151
:param runtime: Python version to build dependencies for. This can
52-
either be python2.7 or python3.6. These are currently the only
53-
supported values.
52+
either be python3.6, python3.7, python3.8 or python3.9. These are
53+
currently the only supported values.
5454
5555
:type ui: :class:`lambda_builders.actions.python_pip.utils.UI`
5656
:param ui: A class that traps all progress information such as status

aws_lambda_builders/workflows/python_pip/packager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def __init__(self, version):
8181

8282
def get_lambda_abi(runtime):
8383
supported = {
84-
"python2.7": "cp27mu",
8584
"python3.6": "cp36m",
8685
"python3.7": "cp37m",
8786
"python3.8": "cp38",
@@ -100,7 +99,7 @@ def __init__(self, runtime, osutils=None, dependency_builder=None, architecture=
10099
101100
:type runtime: str
102101
:param runtime: Python version to build dependencies for. This can
103-
either be python2.7, python3.6 or python3.7. These are currently the
102+
either be python3.6, python3.7, python3.8 or python3.9. These are currently the
104103
only supported values.
105104
106105
:type osutils: :class:`lambda_builders.utils.OSUtils`

aws_lambda_builders/workflows/ruby_bundler/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bundle install --deployment
6464

6565
### sam build --use-container
6666

67-
This command would use some sort of container, such as `lambci/lambda:build-ruby2.5`.
67+
This command would use some sort of container, such as `public.ecr.aws/sam/build-ruby2.7`.
6868

6969
```shell
7070
# exit with error if vendor/bundle and/or .bundle directory exists and is non-empty

tests/integration/workflows/dotnet_clipackage/test_dotnet.py

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,38 @@ def setUp(self):
2525
self.artifacts_dir = tempfile.mkdtemp()
2626
self.scratch_dir = tempfile.mkdtemp()
2727
self.builder = LambdaBuilder(language="dotnet", dependency_manager="cli-package", application_framework=None)
28-
self.runtime = "dotnetcore2.1" # default to 2.1
28+
self.runtime = "dotnetcore3.1"
2929

3030
def tearDown(self):
3131
shutil.rmtree(self.artifacts_dir)
3232
shutil.rmtree(self.scratch_dir)
3333

34-
def verify_architecture(self, deps_file_name, expected_architecture):
34+
def verify_architecture(self, deps_file_name, expected_architecture, version=None):
3535
deps_file = pathlib.Path(self.artifacts_dir, deps_file_name)
3636

3737
if not deps_file.exists():
3838
self.fail("Failed verifying architecture, {} file not found".format(deps_file_name))
3939

4040
with open(str(deps_file)) as f:
4141
deps_json = json.loads(f.read())
42-
version = self.runtime[-3:]
42+
version = version or self.runtime[-3:]
4343
target_name = ".NETCoreApp,Version=v{}/{}".format(version, expected_architecture)
4444
target = deps_json.get("runtimeTarget").get("name")
4545

4646
self.assertEqual(target, target_name)
4747

4848

49-
class TestDotnet21(TestDotnetBase):
49+
class TestDotnet31(TestDotnetBase):
5050
"""
51-
Tests for dotnetcore 2.1
51+
Tests for dotnetcore 3.1
5252
"""
5353

54+
def setUp(self):
55+
super(TestDotnet31, self).setUp()
56+
self.runtime = "dotnetcore3.1"
57+
5458
def test_with_defaults_file(self):
55-
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile2.1")
59+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")
5660

5761
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime)
5862

@@ -71,45 +75,62 @@ def test_with_defaults_file(self):
7175
self.assertEqual(expected_files, output_files)
7276
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64")
7377

74-
def test_require_parameters(self):
75-
source_dir = os.path.join(self.TEST_DATA_FOLDER, "RequireParameters")
78+
def test_with_defaults_file_x86(self):
79+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")
7680

7781
self.builder.build(
78-
source_dir,
79-
self.artifacts_dir,
80-
self.scratch_dir,
81-
source_dir,
82-
runtime=self.runtime,
83-
options={"--framework": "netcoreapp2.1", "--configuration": "Debug"},
82+
source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=X86_64
8483
)
8584

8685
expected_files = {
8786
"Amazon.Lambda.Core.dll",
8887
"Amazon.Lambda.Serialization.Json.dll",
8988
"Newtonsoft.Json.dll",
90-
"RequireParameters.deps.json",
91-
"RequireParameters.dll",
92-
"RequireParameters.pdb",
93-
"RequireParameters.runtimeconfig.json",
89+
"WithDefaultsFile.deps.json",
90+
"WithDefaultsFile.dll",
91+
"WithDefaultsFile.pdb",
92+
"WithDefaultsFile.runtimeconfig.json",
9493
}
9594

9695
output_files = set(os.listdir(self.artifacts_dir))
9796

9897
self.assertEqual(expected_files, output_files)
99-
self.verify_architecture("RequireParameters.deps.json", "linux-x64")
98+
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64")
99+
100+
def test_with_defaults_file_arm64(self):
101+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")
100102

103+
self.builder.build(
104+
source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=ARM64
105+
)
101106

102-
class TestDotnet31(TestDotnetBase):
107+
expected_files = {
108+
"Amazon.Lambda.Core.dll",
109+
"Amazon.Lambda.Serialization.Json.dll",
110+
"Newtonsoft.Json.dll",
111+
"WithDefaultsFile.deps.json",
112+
"WithDefaultsFile.dll",
113+
"WithDefaultsFile.pdb",
114+
"WithDefaultsFile.runtimeconfig.json",
115+
}
116+
117+
output_files = set(os.listdir(self.artifacts_dir))
118+
119+
self.assertEqual(expected_files, output_files)
120+
self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64")
121+
122+
123+
class TestDotnet6(TestDotnetBase):
103124
"""
104-
Tests for dotnetcore 3.1
125+
Tests for dotnet 6
105126
"""
106127

107128
def setUp(self):
108-
super(TestDotnet31, self).setUp()
109-
self.runtime = "dotnetcore3.1"
129+
super(TestDotnet6, self).setUp()
130+
self.runtime = "dotnet6"
110131

111132
def test_with_defaults_file(self):
112-
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")
133+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile6")
113134

114135
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime)
115136

@@ -126,10 +147,10 @@ def test_with_defaults_file(self):
126147
output_files = set(os.listdir(self.artifacts_dir))
127148

128149
self.assertEqual(expected_files, output_files)
129-
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64")
150+
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64", version="6.0")
130151

131152
def test_with_defaults_file_x86(self):
132-
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")
153+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile6")
133154

134155
self.builder.build(
135156
source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=X86_64
@@ -148,10 +169,10 @@ def test_with_defaults_file_x86(self):
148169
output_files = set(os.listdir(self.artifacts_dir))
149170

150171
self.assertEqual(expected_files, output_files)
151-
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64")
172+
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64", version="6.0")
152173

153174
def test_with_defaults_file_arm64(self):
154-
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")
175+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile6")
155176

156177
self.builder.build(
157178
source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=ARM64
@@ -170,4 +191,4 @@ def test_with_defaults_file_arm64(self):
170191
output_files = set(os.listdir(self.artifacts_dir))
171192

172193
self.assertEqual(expected_files, output_files)
173-
self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64")
194+
self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64", version="6.0")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.1</TargetFramework>
3+
<TargetFramework>net6.0</TargetFramework>
44
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
55
<AWSProjectType>Lambda</AWSProjectType>
66
</PropertyGroup>
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
{
2-
"Information" : [
2+
"Information": [
33
"This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
44
"To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
5-
65
"dotnet lambda help",
7-
86
"All the command line options for the Lambda command can be specified in this file."
97
],
10-
11-
"profile":"",
12-
"region" : "",
13-
"configuration" : "Release",
14-
"framework" : "netcoreapp2.1",
15-
"function-runtime":"dotnetcore2.1",
16-
"function-memory-size" : 256,
17-
"function-timeout" : 30,
18-
"function-handler" : "WithDefaultsFile::WithDefaultsFile.Function::FunctionHandler"
19-
}
8+
"profile": "",
9+
"region": "",
10+
"configuration": "Release",
11+
"framework": "net6.0",
12+
"function-runtime": "dotnet6",
13+
"function-memory-size": 256,
14+
"function-timeout": 30,
15+
"function-handler": "WithDefaultsFile::WithDefaultsFile.Function::FunctionHandler"
16+
}

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ def setUp(self):
4343
language=self.builder.capability.language, major=sys.version_info.major, minor=sys.version_info.minor
4444
)
4545
self.runtime_mismatch = {
46-
"python3.6": "python2.7",
47-
"python3.7": "python2.7",
48-
"python2.7": "python3.8",
49-
"python3.8": "python2.7",
50-
"python3.9": "python2.7",
46+
"python3.6": "python3.7",
47+
"python3.7": "python3.8",
48+
"python3.8": "python3.9",
49+
"python3.9": "python3.7",
5150
}
5251

5352
def tearDown(self):
@@ -70,18 +69,12 @@ def check_architecture_in(self, library, architectures):
7069
)
7170
)
7271

73-
# Temporarily skipping this test in Windows
74-
# Fails and we are not sure why: pip version/multiple Python versions in path/os/pypa issue?
75-
# TODO: Revisit when we deprecate Python2
76-
@skipIf(IS_WINDOWS, "Skip in windows tests")
7772
def test_must_build_python_project(self):
7873
self.builder.build(
7974
self.source_dir, self.artifacts_dir, self.scratch_dir, self.manifest_path_valid, runtime=self.runtime
8075
)
8176

82-
if self.runtime == "python2.7":
83-
expected_files = self.test_data_files.union({"numpy", "numpy-1.15.4.data", "numpy-1.15.4.dist-info"})
84-
elif self.runtime == "python3.6":
77+
if self.runtime == "python3.6":
8578
self.check_architecture_in("numpy-1.17.4.dist-info", ["manylinux2010_x86_64", "manylinux1_x86_64"])
8679
expected_files = self.test_data_files.union({"numpy", "numpy-1.17.4.dist-info"})
8780
else:
@@ -109,13 +102,9 @@ def test_must_build_python_project_with_arm_architecture(self):
109102

110103
self.check_architecture_in("numpy-1.20.3.dist-info", ["manylinux2014_aarch64"])
111104

112-
# Temporarily skipping this test in Windows
113-
# Fails and we are not sure why: pip version/multiple Python versions in path/os/pypa issue?
114-
# TODO: Revisit when we deprecate Python2
115-
@skipIf(IS_WINDOWS, "Skip in windows tests")
116105
def test_mismatch_runtime_python_project(self):
117-
# NOTE : Build still works if other versions of python are accessible on the path. eg: /usr/bin/python2.7
118-
# is still accessible within a python 3 virtualenv.
106+
# NOTE : Build still works if other versions of python are accessible on the path. eg: /usr/bin/python3.7
107+
# is still accessible within a python 3.8 virtualenv.
119108
try:
120109
self.builder.build(
121110
self.source_dir,
@@ -162,11 +151,7 @@ def test_must_fail_to_resolve_dependencies(self):
162151
self.source_dir, self.artifacts_dir, self.scratch_dir, self.manifest_path_invalid, runtime=self.runtime
163152
)
164153

165-
# In Python2 a 'u' is now added to the exception string. To account for this, we see if either one is in the
166-
# output
167-
message_in_exception = "Invalid requirement: 'boto3=1.19.99'" in str(
168-
ctx.exception
169-
) or "Invalid requirement: u'boto3=1.19.99'" in str(ctx.exception)
154+
message_in_exception = "Invalid requirement: 'boto3=1.19.99'" in str(ctx.exception)
170155
self.assertTrue(message_in_exception)
171156

172157
def test_must_log_warning_if_requirements_not_found(self):

tests/integration/workflows/ruby_bundler/test_ruby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def setUp(self):
2727
self.dependencies_dir = tempfile.mkdtemp()
2828
self.no_deps = os.path.join(self.TEST_DATA_FOLDER, "no-deps")
2929
self.builder = LambdaBuilder(language="ruby", dependency_manager="bundler", application_framework=None)
30-
self.runtime = "ruby2.5"
30+
self.runtime = "ruby2.7"
3131

3232
def tearDown(self):
3333
shutil.rmtree(self.artifacts_dir)

tests/unit/test_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_validate_with_unsupported_runtime(self):
2222
validator.validate("/usr/bin/unknown_runtime")
2323

2424
def test_validate_with_runtime_and_incompatible_architecture(self):
25-
runtime_list = ["dotnetcore2.1", "nodejs10.x", "ruby2.5", "python3.6", "python3.7", "python2.7"]
25+
runtime_list = ["python3.6", "python3.7"]
2626
for runtime in runtime_list:
2727
validator = RuntimeValidator(runtime=runtime, architecture="arm64")
2828
with self.assertRaises(UnsupportedArchitectureError):

tests/unit/test_workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
324324
"artifacts_dir",
325325
"scratch_dir",
326326
"manifest_path",
327-
runtime="python2.7",
327+
runtime="python3.7",
328328
executable_search_paths=[str(pathlib.Path(os.getcwd()).parent)],
329329
optimizations={"a": "b"},
330330
options={"c": "d"},
@@ -333,7 +333,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
333333
validator_mock = Mock()
334334
validator_mock.validate = Mock()
335335
validator_mock.validate = MagicMock(
336-
side_effect=UnsupportedArchitectureError(runtime="python2.7", architecture="arm64")
336+
side_effect=UnsupportedArchitectureError(runtime="python3.7", architecture="arm64")
337337
)
338338

339339
resolver_mock = Mock()
@@ -349,7 +349,7 @@ def test_must_raise_for_incompatible_runtime_and_architecture(self):
349349
with self.assertRaises(WorkflowFailedError) as ex:
350350
self.work.run()
351351

352-
self.assertIn("Architecture arm64 is not supported for runtime python2.7", str(ex.exception))
352+
self.assertIn("Architecture arm64 is not supported for runtime python3.7", str(ex.exception))
353353

354354

355355
class TestBaseWorkflow_repr(TestCase):

0 commit comments

Comments
 (0)