Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 additions & 2 deletions samcli/commands/init/init_flow_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,15 @@ def compare_runtimes(first_runtime, second_runtime):

if first_runtime_name == second_runtime_name:
if first_version_number == second_version_number:
# If it's the same runtime and version return al2 first
return -1 if first_runtime.endswith(".al2") else 1

Comment thread
ckawl marked this conversation as resolved.
def _os_variant_rank(r: str) -> int:
Comment thread
ckawl marked this conversation as resolved.
if r.endswith(".al2023"):
return 0
if r.endswith(".al2"):
return 1
return 2

return _os_variant_rank(first_runtime) - _os_variant_rank(second_runtime)
Comment on lines +87 to +94

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this change the behavior? Say that runtime 1 is java8.al2 and the second is python3.12. In the old version, that would return -1. In the new version, the return is 1 - 0, which is 1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ig that pair (java8.al2 vs python3.12) never hits this code, since java vs python are different names so it returns on the name comparison. and the java8 without suffix doesn't exist in INIT_RUNTIMES so that situation will never happens either. So for the real pairs (java8.al2 vs java8.al2023, java17 vs java17.al2023), we've flipped to newest-os-first per Renato's feedback.

return second_version_number - first_version_number

return 1 if first_runtime_name > second_runtime_name else -1
Expand Down
29 changes: 28 additions & 1 deletion samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ def get_layer_subfolder(build_workflow: str) -> str:
"ruby3.3": "ruby/lib",
"ruby3.4": "ruby/lib",
"ruby4.0": "ruby/lib",
"java11": "java",
"java8.al2": "java",
"java8.al2023": "java",
"java11": "java",
"java11.al2023": "java",
"java17": "java",
"java17.al2023": "java",
"java21": "java",
"java25": "java",
"dotnet6": "dotnet",
Expand Down Expand Up @@ -199,6 +202,22 @@ def get_workflow_config(
JAVA_MAVEN_CONFIG,
]
),
"java8.al2023": 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,
]
),
"java11.al2023": 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,
]
),
"java17": ManifestWorkflowSelector(
[
# Gradle builder needs custom executable paths to find `gradlew` binary
Expand All @@ -207,6 +226,14 @@ def get_workflow_config(
JAVA_MAVEN_CONFIG,
]
),
"java17.al2023": 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,
]
),
"java21": ManifestWorkflowSelector(
[
# Gradle builder needs custom executable paths to find `gradlew` binary
Expand Down
3 changes: 3 additions & 0 deletions samcli/lib/utils/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
"ruby3.4": [ARM64, X86_64],
"ruby4.0": [ARM64, X86_64],
"java8.al2": [ARM64, X86_64],
"java8.al2023": [ARM64, X86_64],
"java11": [ARM64, X86_64],
"java11.al2023": [ARM64, X86_64],
"java17": [ARM64, X86_64],
"java17.al2023": [ARM64, X86_64],
"java21": [ARM64, X86_64],
"java25": [ARM64, X86_64],
"go1.x": [X86_64],
Expand Down
2 changes: 1 addition & 1 deletion samcli/lib/utils/lambda_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def patch_runtime(runtime: str) -> str:
# NOTE: provided runtimes (provided, provided.al2, etc) are all recognized as "provided" in Lambda Builders
if runtime.startswith("provided"):
runtime = "provided"
return runtime.replace(".al2", "")
return runtime.replace(".al2023", "").replace(".al2", "")
31 changes: 29 additions & 2 deletions samcli/local/common/runtime_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,31 @@
],
"java": [
{
"runtimes": ["java11", "java8.al2", "java17", "java21", "java25"],
"runtimes": [
"java8.al2023",
"java8.al2",
"java11.al2023",
"java11",
"java17.al2023",
"java17",
"java21",
"java25",
],
"dependency_manager": "maven",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-java-maven"),
"build": True,
},
{
"runtimes": ["java11", "java8.al2", "java17", "java21", "java25"],
"runtimes": [
"java8.al2023",
"java8.al2",
"java11.al2023",
"java11",
"java17.al2023",
"java17",
"java21",
"java25",
],
"dependency_manager": "gradle",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-java-gradle"),
"build": True,
Expand Down Expand Up @@ -115,8 +133,11 @@ def get_local_lambda_images_location(mapping, runtime):
# java runtimes in descending order
"java25",
"java21",
"java17.al2023",
"java17",
"java11.al2023",
"java11",
"java8.al2023",
"java8.al2",
# nodejs runtimes in descending order
"nodejs24.x",
Expand Down Expand Up @@ -154,8 +175,11 @@ def get_local_lambda_images_location(mapping, runtime):
"java25": "amazon/java25-base",
"java21": "amazon/java21-base",
"java17": "amazon/java17-base",
"java17.al2023": "amazon/java17.al2023-base",
"java11": "amazon/java11-base",
"java11.al2023": "amazon/java11.al2023-base",
"java8.al2": "amazon/java8.al2-base",
"java8.al2023": "amazon/java8.al2023-base",
"nodejs24.x": "amazon/nodejs24.x-base",
"nodejs22.x": "amazon/nodejs22.x-base",
"nodejs20.x": "amazon/nodejs20.x-base",
Expand All @@ -181,8 +205,11 @@ def get_local_lambda_images_location(mapping, runtime):
# event schema registry supports only java8, python3.6, dotnet6, and Go1 for code binding
SAM_RUNTIME_TO_SCHEMAS_CODE_LANG_MAPPING = {
"java8.al2": "Java8",
"java8.al2023": "Java8",
"java11": "Java8",
"java11.al2023": "Java8",
"java17": "Java8",
"java17.al2023": "Java8",
"java21": "Java8",
"java25": "Java8",
"python3.8": "Python36",
Expand Down
30 changes: 30 additions & 0 deletions samcli/local/docker/lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.java8al2023.value: lambda: DebugSettings(
entry,
container_env_vars={
"_JAVA_OPTIONS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,quiet=y,"
f"address={debug_port} -XX:MaxHeapSize=2834432k -XX:MaxMetaspaceSize=163840k "
"-XX:ReservedCodeCacheSize=81920k -XX:+UseSerialGC -XX:-TieredCompilation "
"-Djava.net.preferIPv4Stack=true -Xshare:off" + " ".join(debug_args_list),
**_container_env_vars,
},
),
Runtime.java11.value: lambda: DebugSettings(
entry,
container_env_vars={
Expand All @@ -73,6 +83,16 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.java11al2023.value: lambda: DebugSettings(
entry,
container_env_vars={
"_JAVA_OPTIONS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,quiet=y,"
f"address=*:{debug_port} -XX:MaxHeapSize=2834432k -XX:MaxMetaspaceSize=163840k "
"-XX:ReservedCodeCacheSize=81920k -XX:+UseSerialGC -XX:-TieredCompilation "
"-Djava.net.preferIPv4Stack=true" + " ".join(debug_args_list),
**_container_env_vars,
},
),
Runtime.java17.value: lambda: DebugSettings(
entry,
container_env_vars={
Expand All @@ -83,6 +103,16 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.java17al2023.value: lambda: DebugSettings(
entry,
container_env_vars={
"_JAVA_OPTIONS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,quiet=y,"
f"address=*:{debug_port} -XX:MaxHeapSize=2834432k -XX:+UseSerialGC "
"-XX:+TieredCompilation -XX:TieredStopAtLevel=1 "
"-Djava.net.preferIPv4Stack=true" + " ".join(debug_args_list),
**_container_env_vars,
},
),
Runtime.java21.value: lambda: DebugSettings(
entry,
container_env_vars={
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 @@ -58,8 +58,11 @@ class Runtime(Enum):
ruby34 = "ruby3.4"
ruby40 = "ruby4.0"
java8al2 = "java8.al2"
java8al2023 = "java8.al2023"
java11 = "java11"
java11al2023 = "java11.al2023"
java17 = "java17"
java17al2023 = "java17.al2023"
java21 = "java21"
java25 = "java25"
go1x = "go1.x"
Expand Down
Loading
Loading