Skip to content

Commit

Permalink
Merge from aws/aws-sam-cli/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot authored Feb 22, 2024
2 parents 782dd01 + c77cc3e commit 9277063
Show file tree
Hide file tree
Showing 190 changed files with 1,796 additions and 1,640 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.19'
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ tests/integration/testdata/buildcmd/Dotnet6/bin
tests/integration/testdata/buildcmd/Dotnet6/obj
tests/integration/testdata/buildcmd/Dotnet7/bin
tests/integration/testdata/buildcmd/Dotnet7/obj
tests/integration/testdata/buildcmd/Dotnet8/bin
tests/integration/testdata/buildcmd/Dotnet8/obj
tests/integration/testdata/invoke/credential_tests/inprocess/dotnet/STS/obj
tests/integration/testdata/sync/code/after/dotnet_function/src/HelloWorld/obj/
tests/integration/testdata/sync/code/before/dotnet_function/src/HelloWorld/obj/
Expand Down
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
2 changes: 1 addition & 1 deletion designs/per_command_help_text.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Usage: sam build [OPTIONS] [RESOURCE_LOGICAL_ID]
2. Nodejs 18.x, 16.x, 14.x, 12.x using NPM
3. Ruby 2.7 using Bundler
3. Ruby3.2 using Bundler
4. Java 8, Java 11 using Gradle and Maven
Expand Down
10 changes: 5 additions & 5 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ click~=8.1
Flask<3.1
boto3>=1.29.2,<2
jmespath~=1.0.1
ruamel_yaml~=0.18.5
ruamel_yaml~=0.18.6
PyYAML~=6.0,>=6.0.1
cookiecutter~=2.5.0
aws-sam-translator==1.84.0
aws-sam-translator==1.85.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=7.0.0
dateparser~=1.2
requests~=2.31.0
aws_lambda_builders==1.45.0
aws_lambda_builders==1.46.0
tomlkit==0.12.3
watchdog==3.0.0
rich~=13.7.0
Expand All @@ -28,7 +28,7 @@ regex!=2021.10.8
tzlocal==5.2

#Adding cfn-lint dependency for SAM validate
cfn-lint~=0.85.0
cfn-lint~=0.85.1

# Type checking boto3 objects
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.32
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.43
11 changes: 6 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ types-pywin32==306.0.0.20240130
types-PyYAML==6.0.12.12
types-chevron==0.14.2.20240106
types-psutil==5.9.5.20240205
types-setuptools==69.0.0.20240125
types-setuptools==69.1.0.20240215
types-Pygments==2.17.0.20240106
types-colorama==0.4.15.20240205
types-dateparser==1.1.4.20240106
Expand All @@ -24,17 +24,18 @@ 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.1
# 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
black==24.1.1
black==24.2.0
psutil==5.9.8
2 changes: 1 addition & 1 deletion requirements/pre-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.2.0
ruff==0.2.1
4 changes: 2 additions & 2 deletions requirements/pyinstaller-build.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Executable binary builder requirements
setuptools==69.0.3
pyinstaller==6.3.0
setuptools==69.1.0
pyinstaller==6.4.0
630 changes: 314 additions & 316 deletions requirements/reproducible-linux.txt

Large diffs are not rendered by default.

630 changes: 314 additions & 316 deletions requirements/reproducible-mac.txt

Large diffs are not rendered by default.

636 changes: 317 additions & 319 deletions requirements/reproducible-win.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion samcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
SAM CLI version
"""

__version__ = "1.109.0"
__version__ = "1.110.0"
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
6 changes: 3 additions & 3 deletions samcli/commands/build/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
\b
Supported Runtimes
------------------
1. Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 using PIP\n
1. Python 3.8, 3.9, 3.10, 3.11, 3.12 using PIP\n
2. Nodejs 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
3. Ruby 2.7, 3.2 using Bundler\n
3. Ruby 3.2 using Bundler\n
4. Java 8, Java 11, Java 17, Java 21 using Gradle and Maven\n
5. Dotnet6 using Dotnet CLI (without --use-container)\n
5. Dotnet8, Dotnet6 using Dotnet CLI\n
6. Go 1.x using Go Modules (without --use-container)\n
"""

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
4 changes: 3 additions & 1 deletion samcli/commands/local/start_api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from samcli.commands.local.start_api.core.command import InvokeAPICommand
from samcli.lib.telemetry.metric import track_command
from samcli.lib.utils.version_checker import check_newer_version
from samcli.local.docker.exceptions import ContainerNotStartableException, PortAlreadyInUse
from samcli.local.docker.exceptions import ContainerNotStartableException, PortAlreadyInUse, ProcessSigTermException

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -290,3 +290,5 @@ def do_cli( # pylint: disable=R0914
raise UserException(str(ex), wrapped_from=ex.__class__.__name__) from ex
except ContainerNotStartableException as ex:
raise UserException(str(ex), wrapped_from=ex.__class__.__name__) from ex
except ProcessSigTermException:
LOG.debug("Successfully exited SIGTERM terminated process")
4 changes: 3 additions & 1 deletion samcli/commands/local/start_lambda/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from samcli.commands.local.start_lambda.core.command import InvokeLambdaCommand
from samcli.lib.telemetry.metric import track_command
from samcli.lib.utils.version_checker import check_newer_version
from samcli.local.docker.exceptions import ContainerNotStartableException, PortAlreadyInUse
from samcli.local.docker.exceptions import ContainerNotStartableException, PortAlreadyInUse, ProcessSigTermException

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -228,3 +228,5 @@ def do_cli( # pylint: disable=R0914
raise UserException(str(ex), wrapped_from=ex.__class__.__name__) from ex
except ContainerNotStartableException as ex:
raise UserException(str(ex), wrapped_from=ex.__class__.__name__) from ex
except ProcessSigTermException:
LOG.debug("Successfully exited SIGTERM terminated process")
4 changes: 4 additions & 0 deletions samcli/lib/build/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
"nodejs6.10",
"nodejs8.10",
"nodejs10.x",
"nodejs12.x",
"nodejs14.x",
"dotnetcore2.0",
"dotnetcore2.1",
"dotnetcore3.1",
"python2.7",
"python3.6",
"python3.7",
"ruby2.5",
"ruby2.7",
}
BUILD_PROPERTIES = "BuildProperties"
12 changes: 3 additions & 9 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def get_selector(

def get_layer_subfolder(build_workflow: str) -> str:
subfolders_by_runtime = {
"python3.7": "python",
"python3.8": "python",
"python3.9": "python",
"python3.10": "python",
Expand All @@ -94,19 +93,17 @@ 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",
"ruby2.7": "ruby/lib",
"ruby3.2": "ruby/lib",
"java8": "java",
"java11": "java",
"java8.al2": "java",
"java17": "java",
"java21": "java",
"dotnet6": "dotnet",
"dotnet8": "dotnet",
# User is responsible for creating subfolder in these workflows
"makefile": "",
}
Expand Down Expand Up @@ -139,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 @@ -155,20 +152,17 @@ def get_workflow_config(
}

selectors_by_runtime = {
"python3.7": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.8": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.9": BasicWorkflowSelector(PYTHON_PIP_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),
"ruby2.7": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"ruby3.2": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"dotnet6": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"dotnet8": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"go1.x": BasicWorkflowSelector(GO_MOD_CONFIG),
# When Maven builder exists, add to this list so we can automatically choose a builder based on the supported
# manifest
Expand Down
24 changes: 7 additions & 17 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,7 @@
"useCaseName": "Hello World Example"
}
],
"nodejs12.x": [
"nodejs18.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
Expand All @@ -93,17 +93,17 @@
"useCaseName": "Hello World Example"
}
],
"python3.9": [
"nodejs16.x": [
{
"directory": "template/cookiecutter-aws-sam-hello-python",
"directory": "template/cookiecutter-aws-sam-hello-nodejs",
"displayName": "Hello World Example",
"dependencyManager": "pip",
"dependencyManager": "npm",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
],
"python3.8": [
"python3.9": [
{
"directory": "template/cookiecutter-aws-sam-hello-python",
"displayName": "Hello World Example",
Expand All @@ -113,7 +113,7 @@
"useCaseName": "Hello World Example"
}
],
"python3.7": [
"python3.8": [
{
"directory": "template/cookiecutter-aws-sam-hello-python",
"displayName": "Hello World Example",
Expand All @@ -122,15 +122,5 @@
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
],
"ruby2.7": [
{
"directory": "template/cookiecutter-aws-sam-hello-ruby",
"displayName": "Hello World Example",
"dependencyManager": "bundler",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
]
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ A cookiecutter template to create a Python Hello world boilerplate using [Server

Generate a boilerplate template in your current project directory using the following syntax:

* **Python 3.7**: `sam init --runtime python3.7`
* **Python 3.8**: `sam init --runtime python3.8`
* **Python 3.9**: `sam init --runtime python3.9`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A cookiecutter template to create a Ruby Hello world boilerplate using [Serverle

Generate a boilerplate template in your current project directory using the following syntax:

* **Ruby 2.5**: `sam init --runtime ruby2.5`
* **Ruby 3.2**: `sam init --runtime ruby3.2`

> **NOTE**: ``--name`` allows you to specify a different project folder name (`sam-app` is the default)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"project_name": "Name of the project",
"runtime": "ruby2.5",
"runtime": "ruby3.2",
"architectures": {
"value": [
"x86_64"
Expand Down
4 changes: 2 additions & 2 deletions samcli/lib/providers/sam_stack_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def normalize_resource_path(stack_file_path: str, path: str) -> str:
* symlinks on Windows might not work properly.
https://stackoverflow.com/questions/43333640/python-os-path-realpath-for-symlink-in-windows
For example, using Python 3.7, realpath() is a no-op (same as abspath):
For example, using Python 3.8, realpath() is a no-op (same as abspath):
```
Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32
Python 3.8.8 (tags/v3.8.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.symlink('some\\path', 'link1')
Expand Down
7 changes: 6 additions & 1 deletion samcli/lib/sync/sync_flow_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
from concurrent.futures import Future, ThreadPoolExecutor
from dataclasses import dataclass
from datetime import datetime
from queue import Queue
from threading import RLock
from typing import Callable, List, Optional, Set
Expand Down Expand Up @@ -311,8 +312,12 @@ def _handle_result(
sync_flow_result: SyncFlowResult = future.result()
for dependent_sync_flow in sync_flow_result.dependent_sync_flows:
self.add_sync_flow(dependent_sync_flow)
message = (
f"{datetime.now().strftime('%d/%b/%Y:%H:%M:%S')}: "
f"Finished syncing {sync_flow_result.sync_flow.log_name}."
)
LOG.info(
self._color.color_log(msg=f"Finished syncing {sync_flow_result.sync_flow.log_name}.", color="green"),
self._color.color_log(msg=message, color="green"),
extra=dict(markup=True),
)
return True
Expand Down
Loading

0 comments on commit 9277063

Please sign in to comment.