Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
15e617f
chore: Support Java11, Python3.8, and Nodejs12.x runtimes
jfuss Nov 11, 2019
a009a08
upgrade lambda builders and support java11 in process builds
jfuss Nov 19, 2019
3e83ad9
Run all python version builds on windows
jfuss Nov 19, 2019
0168a1c
MarkupSafe, dependency of jinja2, does not build locally due to no py…
jfuss Nov 19, 2019
5efc92b
Fix python integ build tests
jfuss Nov 19, 2019
dad947f
Install python3.8 on appveyor python build tests
jfuss Nov 19, 2019
588e2d5
add where choco installs python38 and ensure it is on the PATH
jfuss Nov 19, 2019
6974996
python38 is not a command in windows :(
jfuss Nov 19, 2019
e7fbc41
try something else with python3.8
jfuss Nov 19, 2019
184fea0
Get paths for different python version in ubuntu
jfuss Nov 19, 2019
92b8695
try apt-get python versions
jfuss Nov 19, 2019
a5e0b14
use sudo apt-get
jfuss Nov 19, 2019
17cfa92
add -y to apt-get commands
jfuss Nov 19, 2019
fef4ff2
update apt-get to see if python3.8 is there yet
jfuss Nov 19, 2019
ac89768
fix single build integ tests
jfuss Nov 19, 2019
43f428d
Try running all python build tests always
jfuss Nov 19, 2019
adc8dda
adding other python versions to end of PATH in linux
jfuss Nov 19, 2019
bba35e4
See if pip is in python3.8
jfuss Nov 19, 2019
9b2d682
install pip in each python version
jfuss Nov 19, 2019
e309421
Try apt-get install python3-distutils
jfuss Nov 19, 2019
28ac955
add -y to apt-get
jfuss Nov 19, 2019
f1935ac
add --user
jfuss Nov 19, 2019
e80e125
Don't install pip in python3.7 builds
jfuss Nov 19, 2019
ae95ea0
rerun java11 tests with javahome as java11
jfuss Nov 19, 2019
4eafdc9
Remove some commented out test code
jfuss Nov 19, 2019
81ed055
fix single python build by removing jinja2
jfuss Nov 20, 2019
7008407
install pip in python3.6
jfuss Nov 20, 2019
e1ee382
Fix typo
jfuss Nov 20, 2019
2badbdb
Support debugging for python3.8 and node12.x
jfuss Nov 20, 2019
9b68a19
Merge branch 'develop' into support/new-runtimes
jfuss Nov 21, 2019
e0d4c24
Merge branch 'develop' into support/new-runtimes
jfuss Nov 21, 2019
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
4 changes: 3 additions & 1 deletion appveyor-windows-build-java-inprocess.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ install:
test_script:
# Reactivate virtualenv before running tests
- "venv\\Scripts\\activate"
- "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java_in_process"
- "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java8_in_process"
- "SET JAVA_HOME=C:\\Program Files\\Java\\jdk11"
- "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java11_in_process"
7 changes: 6 additions & 1 deletion appveyor-windows-build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ init:
install:

# Make sure the temp directory exists for Python to use.
# Install python3.8
- "choco install python3 --version 3.8.0"
- "C:\\Python38\\python.exe -m pip freeze"
- "refreshenv"

- ps: "mkdir -Force D:\\tmp"
- "SET PATH=%PYTHON_HOME%;%PATH%"
- "SET PATH=%PYTHON_HOME%;%PATH%;C:\\Python37-x64;C:\\Python27-x64;C:\\Python38"
- "echo %PYTHON_HOME%"
- "echo %PATH%"
- "python --version"
Expand Down
26 changes: 25 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ environment:
PYTHON_VERSION: '3.6.8'
PYTHON_ARCH: '64'
NOSE_PARAMETERIZED_NO_WARN: 1
INSTALL_PY_37_PIP: 1

- PYTHON_HOME: "C:\\Python37-x64"
PYTHON_VERSION: '3.7.4'
PYTHON_ARCH: '64'
RUN_SMOKE: 1
NOSE_PARAMETERIZED_NO_WARN: 1
INSTALL_PY_36_PIP: 1

for:
-
Expand Down Expand Up @@ -98,6 +100,25 @@ for:
- sh: "./aws_cli/bin/python -m pip install awscli"
- sh: "PATH=$(echo $PWD'/aws_cli/bin'):$PATH"

- sh: "sudo apt-get -y install python3.6"
- sh: "sudo apt-get -y install python2.7"
- sh: "sudo apt-get -y install python3.7"
- sh: "sudo apt-get update"
- sh: "sudo apt-get -y install python3.8"

- sh: "which python3.8"
- sh: "which python3.6"
- sh: "which python3.7"
- sh: "which python2.7"

- sh: "PATH=$PATH:/usr/bin/python3.8:/usr/bin/python3.7"
Copy link
Contributor

Choose a reason for hiding this comment

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

do 3.6 and 2.7 also need to be added to path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

2.7 and 3.6 are already there: https://www.appveyor.com/docs/linux-images-software/#python

I am considering moving off of the pre-installed everything in favor how installing python versions through apt-get. This will make things a little more consistent in appveyor, but didn't want to go that deep here.

- sh: "curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"

- sh: "sudo apt-get -y install python3-distutils"
- sh: "python3.8 get-pip.py --user"
- ps: "If ($env:INSTALL_PY_37_PIP) {python3.7 get-pip.py --user}"
- ps: "If ($env:INSTALL_PY_36_PIP) {python3.6 get-pip.py --user}"

build_script:
- "python -c \"import sys; print(sys.executable)\""
- "pip install -e \".[dev]\""
Expand All @@ -113,7 +134,10 @@ for:
- sh: "pytest -vv tests/integration"
- sh: "pytest -vv -n 4 tests/regression"
- sh: "/tmp/black --check setup.py tests samcli scripts"
- sh: "python scripts/check-isolated-needs-update.py"

# Set JAVA_HOME to java11
- sh: "JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
Copy link
Contributor

Choose a reason for hiding this comment

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

JAVA_HOME for java8 is not set. I am not sure how appveyor works, but can this be an issue on next run, when JAVA_HOME will be for java11 and test would run expecting them to be 8?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, now that I think about it, it shouldn't be an issue since it'll be a new session.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We set JAVA_HOME to java8 on line 82 (first step in the install step). The first pass of build tests will run with java8. I needed a way to also run the Java11 build tests. Instead of creating another appveyor project, I edit the JAVA_HOME env var to be java11 within the test_script phase of appveyor.

- sh: "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java11_in_process"

# Smoke tests run in parallel - it runs on both Linux & Windows
# Presence of the RUN_SMOKE envvar will run the smoke tests
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ dateparser~=0.7
python-dateutil~=2.6, <2.8.1
requests==2.22.0
serverlessrepo==0.1.9
aws_lambda_builders==0.5.0
aws_lambda_builders==0.6.0
# https://github.com/mhammond/pywin32/issues/1439
pywin32 < 226; sys_platform == 'win32'
8 changes: 8 additions & 0 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ def get_workflow_config(runtime, code_dir, project_dir):
"python2.7": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.6": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.7": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.8": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"nodejs4.3": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs6.10": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs8.10": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs10.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs12.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"ruby2.5": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"dotnetcore2.0": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"dotnetcore2.1": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
Expand All @@ -111,6 +113,12 @@ def get_workflow_config(runtime, code_dir, project_dir):
JAVA_KOTLIN_GRADLE_CONFIG._replace(executable_search_paths=[code_dir, project_dir]),
JAVA_MAVEN_CONFIG
]),
"java11": ManifestWorkflowSelector([
# Gradle builder needs custom executable paths to find `gradlew` binary
JAVA_GRADLE_CONFIG._replace(executable_search_paths=[code_dir, project_dir]),
JAVA_KOTLIN_GRADLE_CONFIG._replace(executable_search_paths=[code_dir, project_dir]),
JAVA_MAVEN_CONFIG
]),
}

if runtime not in selectors_by_runtime:
Expand Down
27 changes: 20 additions & 7 deletions samcli/local/common/runtime_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
RUNTIME_DEP_TEMPLATE_MAPPING = {
"python": [
{
"runtimes": ["python3.7", "python3.6", "python2.7"],
"runtimes": ["python3.8", "python3.7", "python3.6", "python2.7"],
"dependency_manager": "pip",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-python"),
"build": True,
Expand All @@ -30,7 +30,7 @@
],
"nodejs": [
{
"runtimes": ["nodejs10.x", "nodejs8.10"],
"runtimes": ["nodejs12.x", "nodejs10.x", "nodejs8.10"],
"dependency_manager": "npm",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"),
"build": True,
Expand Down Expand Up @@ -60,13 +60,13 @@
],
"java": [
{
"runtimes": ["java8"],
"runtimes": ["java11", "java8"],
"dependency_manager": "maven",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-java-maven"),
"build": True,
},
{
"runtimes": ["java8"],
"runtimes": ["java11", "java8"],
"dependency_manager": "gradle",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-java-gradle"),
"build": True,
Expand All @@ -75,10 +75,12 @@
}

RUNTIME_TO_DEPENDENCY_MANAGERS = {
"python3.8": ["pip"],
"python3.7": ["pip"],
"python3.6": ["pip"],
"python2.7": ["pip"],
"ruby2.5": ["bundler"],
"nodejs12.x": ["npm"],
"nodejs10.x": ["npm"],
"nodejs8.10": ["npm"],
"nodejs6.10": ["npm"],
Expand All @@ -87,6 +89,7 @@
"dotnetcore1.0": ["cli-package"],
"go1.x": ["mod"],
"java8": ["maven", "gradle"],
"java11": ["maven", "gradle"],
}

SUPPORTED_DEP_MANAGERS = {
Expand All @@ -99,17 +102,27 @@
itertools.chain(*[c["runtimes"] for c in list(itertools.chain(*(RUNTIME_DEP_TEMPLATE_MAPPING.values())))])
)

# Order here should be a the group of the latest versions of runtimes followed by runtime groups
INIT_RUNTIMES = [
"nodejs10.x",
"python3.7",
# latest of each runtime version
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this list is what is used to showcases the runtimes during init, we should make this ordered, with a set maybe.

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 is ordered just in a list. I can update it to a set but there isn't a whole difference here (other than duplicate entry guard).

This is used within interactive init not in the help text.

"nodejs12.x",
"python3.8",
"ruby2.5",
"go1.x",
"java8",
"java11",
"dotnetcore2.1",
# older nodejs runtimes
"nodejs10.x",
"nodejs8.10",
"nodejs6.10",
# older python runtimes
"python3.7",
"python3.6",
"python2.7",
# older ruby runtimes
# older java runtimes
"java8",
# older dotnetcore runtimes
"dotnetcore2.0",
"dotnetcore1.0",
]
24 changes: 24 additions & 0 deletions samcli/local/docker/lambda_debug_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ def get_entry_point(debug_port, debug_args_list, runtime, options):
]
),
],
Runtime.nodejs12x.value: [
"/var/rapid/init",
"--bootstrap",
"/var/lang/bin/node",
"--bootstrap-args",
json.dumps(
debug_args_list
+ [
"--inspect-brk=0.0.0.0:" + str(debug_port),
"--nolazy",
"--expose-gc",
"--max-http-header-size",
"81920",
"/var/runtime/index.js",
]
),
],
Runtime.python27.value: ["/usr/bin/python2.7"] + debug_args_list + ["/var/runtime/awslambda/bootstrap.py"],
Runtime.python36.value: ["/var/lang/bin/python3.6"]
+ debug_args_list
Expand All @@ -112,6 +129,13 @@ def get_entry_point(debug_port, debug_args_list, runtime, options):
"--bootstrap-args",
json.dumps(debug_args_list + ["/var/runtime/bootstrap"]),
],
Runtime.python38.value: [
"/var/rapid/init",
"--bootstrap",
"/var/lang/bin/python3.8",
"--bootstrap-args",
json.dumps(debug_args_list + ["/var/runtime/bootstrap"]),
],
}
try:
return entrypoint_mapping[runtime]
Expand Down
3 changes: 3 additions & 0 deletions samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ class Runtime(Enum):
nodejs610 = "nodejs6.10"
nodejs810 = "nodejs8.10"
nodejs10x = "nodejs10.x"
nodejs12x = "nodejs12.x"
python27 = "python2.7"
python36 = "python3.6"
python37 = "python3.7"
python38 = "python3.8"
ruby25 = "ruby2.5"
java8 = "java8"
java11 = "java11"
go1x = "go1.x"
dotnetcore20 = "dotnetcore2.0"
dotnetcore21 = "dotnetcore2.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"project_name": "Name of the project",
"runtime": "java8"
"runtime": "java11"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Resources:
Properties:
CodeUri: HelloWorldFunction
Handler: helloworld.App::handleRequest
Runtime: java8
Runtime: {{ cookiecutter.runtime }}
MemorySize: 512
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"project_name": "Name of the project",
"runtime": "java8"
"runtime": "java11"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Resources:
Properties:
CodeUri: HelloWorldFunction
Handler: helloworld.App::handleRequest
Runtime: java8
Runtime: {{ cookiecutter.runtime }}
MemorySize: 512
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"project_name": "Name of the project",
"runtime": "nodejs10.x"
"runtime": "nodejs12.x"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ Resources:
Properties:
CodeUri: hello-world/
Handler: app.lambdaHandler
{%- if cookiecutter.runtime == 'nodejs8.10' %}
Runtime: {{ cookiecutter.runtime }}
{%- else %}
Runtime: nodejs10.x
{%- endif %}
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"project_name": "Name of the project",
"runtime": "python3.7"
"runtime": "python3.8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ Resources:
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
{%- if cookiecutter.runtime == 'python2.7' %}
Runtime: python2.7
{%- elif cookiecutter.runtime == 'python3.6' %}
Runtime: python3.6
{%- else %}
Runtime: python3.7
{%- endif %}
Runtime: {{ cookiecutter.runtime }}
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Expand Down
Loading