Skip to content

feat: add java8.al2023, java11.al2023, java17.al2023 runtime support#9125

Open
ckawl wants to merge 6 commits into
aws:developfrom
ckawl:feat/java-al2023-runtimes
Open

feat: add java8.al2023, java11.al2023, java17.al2023 runtime support#9125
ckawl wants to merge 6 commits into
aws:developfrom
ckawl:feat/java-al2023-runtimes

Conversation

@ckawl

@ckawl ckawl commented Jul 14, 2026

Copy link
Copy Markdown

Which issue(s) does this change fix?

Support for java8.al2023, java11.al2023, java17.al2023 Lambda managed runtimes launching July 20, 2026.

Why is this change necessary?

AWS Lambda is releasing AL2023 variants of Java 8, 11, and 17 runtimes. SAM CLI needs to recognize these runtimes so users can sam init, sam build, and sam local invoke
with them.

Additionally, the existing patch_runtime function uses .replace(".al2", "") which incorrectly mangles .al2023 (producing java8023 instead of java8). This must be
fixed before the new runtimes can work.

How does it address the issue?

  • Fixes patch_runtime to strip .al2023 before .al2 (order matters to avoid substring match)
  • Adds all 3 runtimes to: architecture.py, workflow_config.py, runtime_template.py, lambda_image.py, samcli.json
  • Adds debug settings entries in lambda_debug_settings.py (same settings as base runtimes)
  • Fixes compare_runtimes in init_flow_helpers.py to handle .al2023 suffix for consistent sort order
  • Follows the exact same pattern as existing java8.al2

What side effects does this change have?

None. All changes are additive. Existing runtimes are unaffected — verified by running unit tests (358 pass), mypy, Black, and ruff.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

ckawl added 3 commits July 13, 2026 10:41
Add support for Java AL2023 runtimes across SAM CLI:
- Fix patch_runtime to correctly strip .al2023 suffix before passing to lambda-builders
- Add runtimes to architecture, workflow config, runtime templates, image mappings
- Update schema and help text
- Add unit tests for new runtimes
- Add java8.al2023, java11.al2023, java17.al2023 to entrypoint_mapping
  in lambda_debug_settings.py (same settings as base runtimes)
- Fix compare_runtimes in init_flow_helpers.py to handle .al2023 suffix
  (previous logic only checked .endswith(".al2"), causing non-antisymmetric
  comparator for al2023 pairs)
- Update _DEBUG_RUNTIMES in test_lambda_debug_settings.py
Add java8.al2023, java11.al2023, java17.al2023 to:
- test_building_java_in_process (non-container, will pass in CI)
- test_building_java_in_container_al2023 (container, will pass once SAM build images are published)
@github-actions github-actions Bot added area/local/start-api sam local start-api command area/init sam init area/build sam build command area/local/invoke sam local invoke command area/local/start-invoke area/schema JSON schema file pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jul 14, 2026
@ckawl
ckawl marked this pull request as ready for review July 14, 2026 00:25
@ckawl
ckawl requested a review from a team as a code owner July 14, 2026 00:25
@ckawl ckawl self-assigned this Jul 14, 2026
valerena
valerena previously approved these changes Jul 14, 2026
Comment on lines +87 to +94
def _os_variant_rank(r: str) -> int:
if r.endswith(".al2023"):
return 2
if r.endswith(".al2"):
return 1
return 0

return _os_variant_rank(first_runtime) - _os_variant_rank(second_runtime)

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
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.

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Results

Reviewed: 56510b1..c31732d
Files: 13
Comments: 1

Comment thread samcli/commands/init/init_flow_helpers.py

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Results

Reviewed: 56510b1..57f0599
Files: 14
Comments: 1

Comment thread samcli/commands/init/init_flow_helpers.py
@ckawl
ckawl requested review from reedham-aws and valerena July 17, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build sam build command area/init sam init area/local/invoke sam local invoke command area/local/start-api sam local start-api command area/local/start-invoke area/schema JSON schema file pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants