Skip to content

Commit

Permalink
Merge branch 'develop' into remove-ruby27
Browse files Browse the repository at this point in the history
  • Loading branch information
hnnasit authored Feb 8, 2024
2 parents e0552d2 + 0650293 commit 704d262
Show file tree
Hide file tree
Showing 36 changed files with 185 additions and 236 deletions.
2 changes: 1 addition & 1 deletion designs/build_for_provided_runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ What will be changed?
---------------------

Serverless Function resources can now have a Metadata Resource Attribute which specifies a `BuildMethod`.
`BuildMethod` will either be the official lambda runtime identifiers such as `python3.8`, `nodejs12.x` etc or `makefile`.
`BuildMethod` will either be the official lambda runtime identifiers such as `python3.8`, `nodejs20.x` etc or `makefile`.
If `BuildMethod` is specified to be `makefile`, the build targets that are present in the `Makefile` which take the form of

`build-{resource_logical_id}` will be executed.
Expand Down
7 changes: 4 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ types-requests==2.31.0.6
types-urllib3==1.26.25.14

# Test requirements
pytest~=7.4.4
pytest~=8.0.0
parameterized==0.9.0
pytest-xdist==3.5.0
pytest-forked==1.6.0
pytest-timeout==2.2.0
pytest-rerunfailures==13.0
# NOTE (hawflau): DO NOT upgrade pytest-metadata and pytest-json-report unless pytest-json-report addresses https://github.com/numirias/pytest-json-report/issues/89
pytest-metadata==2.0.4
pytest-json-report==1.5.0
pytest-metadata==3.1.0
# NOTE (lucashuy): `pytest-json-report` was updated to `pytest-json-report-wip` as the original repository does not seem to be maintained anymore, if `-wip` is updated, validate the changes
pytest-json-report-wip==1.5.1
filelock==3.13.1

# formatter
Expand Down
3 changes: 1 addition & 2 deletions samcli/commands/_utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@

_TEMPLATE_OPTION_DEFAULT_VALUE = "template.[yaml|yml|json]"
SUPPORTED_BUILD_IN_SOURCE_WORKFLOWS = [
Runtime.nodejs12x.value,
Runtime.nodejs14x.value,
Runtime.nodejs16x.value,
Runtime.nodejs18x.value,
Runtime.nodejs20x.value,
"Makefile",
"esbuild",
]
Expand Down
4 changes: 2 additions & 2 deletions samcli/commands/local/cli_common/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def local_common_options(f):
multiple=True,
help="Container image URIs for invoking functions or starting api and function. "
"One can specify the image URI used for the local function invocation "
"(--invoke-image public.ecr.aws/sam/build-nodejs14.x:latest). "
"(--invoke-image public.ecr.aws/sam/build-nodejs20.x:latest). "
"One can also specify for each individual function with "
"(--invoke-image Function1=public.ecr.aws/sam/build-nodejs14.x:latest). "
"(--invoke-image Function1=public.ecr.aws/sam/build-nodejs20.x:latest). "
"If a function does not have invoke image specified, the default AWS SAM CLI "
"emulation image will be used.",
),
Expand Down
6 changes: 1 addition & 5 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ def get_layer_subfolder(build_workflow: str) -> str:
"nodejs4.3": "nodejs",
"nodejs6.10": "nodejs",
"nodejs8.10": "nodejs",
"nodejs12.x": "nodejs",
"nodejs14.x": "nodejs",
"nodejs16.x": "nodejs",
"nodejs18.x": "nodejs",
"nodejs20.x": "nodejs",
Expand Down Expand Up @@ -138,7 +136,7 @@ def get_workflow_config(
specified_workflow str
Workflow to be used, if directly specified. They are currently scoped to "makefile" and the official runtime
identifier names themselves, eg: nodejs14.x. If a workflow is not directly specified,
identifier names themselves, eg: nodejs20.x. If a workflow is not directly specified,
it is calculated by the current method based on the runtime.
Returns
Expand All @@ -160,8 +158,6 @@ def get_workflow_config(
"python3.10": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.11": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.12": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"nodejs12.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs14.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs16.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs18.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs20.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
Expand Down
14 changes: 12 additions & 2 deletions samcli/lib/init/local_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"useCaseName": "Hello World Example"
}
],
"nodejs14.x": [
"nodejs20.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
Expand All @@ -83,7 +83,17 @@
"useCaseName": "Hello World Example"
}
],
"nodejs12.x": [
"nodejs18.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
"dependencyManager": "npm",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
],
"nodejs16.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"project_name": "Name of the project",
"runtime": "nodejs12.x",
"runtime": "nodejs20.x",
"architectures": {
"value": [
"x86_64"
Expand Down
2 changes: 0 additions & 2 deletions samcli/lib/utils/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
ARM64 = "arm64"

SUPPORTED_RUNTIMES: Dict[str, List[str]] = {
"nodejs12.x": [ARM64, X86_64],
"nodejs14.x": [ARM64, X86_64],
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
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 @@ -32,7 +32,7 @@
],
"nodejs": [
{
"runtimes": ["nodejs20.x", "nodejs18.x", "nodejs16.x", "nodejs14.x", "nodejs12.x"],
"runtimes": ["nodejs20.x", "nodejs18.x", "nodejs16.x"],
"dependency_manager": "npm",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"),
"build": True,
Expand Down Expand Up @@ -111,8 +111,6 @@ def get_local_lambda_images_location(mapping, runtime):
"nodejs20.x",
"nodejs18.x",
"nodejs16.x",
"nodejs14.x",
"nodejs12.x",
# custom runtime in descending order
"provided.al2023",
"provided.al2",
Expand Down Expand Up @@ -142,8 +140,6 @@ def get_local_lambda_images_location(mapping, runtime):
"nodejs20.x": "amazon/nodejs20.x-base",
"nodejs18.x": "amazon/nodejs18.x-base",
"nodejs16.x": "amazon/nodejs16.x-base",
"nodejs14.x": "amazon/nodejs14.x-base",
"nodejs12.x": "amazon/nodejs12.x-base",
"python3.12": "amazon/python3.12-base",
"python3.11": "amazon/python3.11-base",
"python3.10": "amazon/python3.10-base",
Expand Down
28 changes: 0 additions & 28 deletions samcli/local/docker/lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,34 +117,6 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.nodejs12x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
+ debug_args_list
+ ["--no-lazy", "--expose-gc"]
+ ["/var/runtime/index.js"],
container_env_vars={
"NODE_PATH": "/opt/nodejs/node_modules:/opt/nodejs/node12/node_modules:/var/runtime/node_modules:"
"/var/runtime:/var/task",
"NODE_OPTIONS": f"--inspect-brk=0.0.0.0:{str(debug_port)} --max-http-header-size 81920",
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs12.x",
**_container_env_vars,
},
),
Runtime.nodejs14x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
+ debug_args_list
+ ["--no-lazy", "--expose-gc"]
+ ["/var/runtime/index.js"],
container_env_vars={
"NODE_PATH": "/opt/nodejs/node_modules:/opt/nodejs/node14/node_modules:/var/runtime/node_modules:"
"/var/runtime:/var/task",
"NODE_OPTIONS": f"--inspect-brk=0.0.0.0:{str(debug_port)} --max-http-header-size 81920",
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs14.x",
**_container_env_vars,
},
),
Runtime.nodejs16x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
Expand Down
4 changes: 1 addition & 3 deletions samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@


class Runtime(Enum):
nodejs12x = "nodejs12.x"
nodejs14x = "nodejs14.x"
nodejs16x = "nodejs16.x"
nodejs18x = "nodejs18.x"
nodejs20x = "nodejs20.x"
Expand Down Expand Up @@ -96,7 +94,7 @@ def get_image_name_tag(cls, runtime: str, architecture: str) -> str:
else:
# This fits most runtimes format: `nameN.M` becomes `name:N.M` (python3.9 -> python:3.9)
runtime_image_tag = re.sub(r"^([a-z]+)([0-9][a-z0-9\.]*)$", r"\1:\2", runtime)
# nodejs14.x, go1.x, etc don't have the `.x` part.
# nodejs20.x, go1.x, etc don't have the `.x` part.
runtime_image_tag = runtime_image_tag.replace(".x", "")

# Runtime image tags contain the architecture only if more than one is supported for that runtime
Expand Down
Loading

0 comments on commit 704d262

Please sign in to comment.