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 Nov 10, 2022
2 parents 63a53ea + 7630807 commit 883abbc
Show file tree
Hide file tree
Showing 360 changed files with 3,958 additions and 2,833 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const maintainers = ['jfuss', 'hoffa', 'awood45', 'aahung', 'hawflau', 'mndeveci', 'ssenchenko', 'qingchm', 'moelasmar', 'xazhao', 'mildaniel', 'marekaiv', 'torresxb1', 'lucashuy', 'hnnasit', 'sriram-mv']
const maintainers = [
'aws-sam-cli-bot',
'jfuss', 'hoffa', 'awood45', 'aahung', 'hawflau', 'mndeveci', 'ssenchenko',
'qingchm', 'moelasmar', 'xazhao', 'mildaniel', 'marekaiv', 'torresxb1',
'lucashuy', 'hnnasit', 'sriram-mv'
]
if (maintainers.includes(context.payload.sender.login)) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ include requirements/pre-dev.txt
include requirements/dev.txt
recursive-include samcli *
prune tests
prune installer
global-exclude *.py[cod]
global-exclude *.DS_Store
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
![Install](https://img.shields.io/badge/brew-aws--sam--cli-orange)
![pip](https://img.shields.io/badge/pip-aws--sam--cli-9cf)

[Installation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) | [Blogs](https://serverlessland.com/blog?tag=AWS%20SAM) | [Videos](https://serverlessland.com/video?tag=AWS%20SAM) | [AWS Docs](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) | [Roadmap](https://github.com/aws/aws-sam-cli/wiki/SAM-CLI-Roadmap) | [Try It Out](https://s12d.com/Tq9ZE-Br)
[Installation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) | [Blogs](https://serverlessland.com/blog?tag=AWS%20SAM) | [Videos](https://serverlessland.com/video?tag=AWS%20SAM) | [AWS Docs](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) | [Roadmap](https://github.com/aws/aws-sam-cli/wiki/SAM-CLI-Roadmap) | [Try It Out](https://s12d.com/jKo46elk) | [Slack Us](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)

The AWS Serverless Application Model (SAM) CLI is an open-source CLI tool that helps you develop serverless applications containing [Lambda functions](https://aws.amazon.com/lambda/), [Step Functions](https://aws.amazon.com/step-functions/), [API Gateway](https://aws.amazon.com/api-gateway/), [EventBridge](https://aws.amazon.com/eventbridge/), [SQS](https://aws.amazon.com/sqs/), [SNS](https://aws.amazon.com/sns/) and more. Some of the features it provides are:
- **Initialize serverless applications** in minutes with AWS-provided infrastructure templates with `sam init`
Expand All @@ -28,10 +28,13 @@ The AWS Serverless Application Model (SAM) CLI is an open-source CLI tool that h

* **Speed up development with SAM Accelerate** - quickly test your changes in the cloud. [Read docs here](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/accelerate.html).

* **The Complete SAM Workshop**- [This workshop](https://s12d.com/jKo46elk) is a great way to experience the power of SAM and SAM CLI.

* **Getting started with CI/CD? SAM pipelines can help you get started** - [This workshop](https://s12d.com/_JQ48d5T) walks you through the basics.

* **Get started with Serverless Application development using SAM CLI** - [This workshop](https://s12d.com/Tq9ZE-Br) walks you through the basics.


## Get Started

To get started with building SAM-based applications, use the SAM CLI. SAM CLI provides a Lambda-like execution
Expand All @@ -51,6 +54,7 @@ environment that lets you locally build, test, debug, and deploy [AWS serverless


## What is this Github repository? 💻

This Github repository contains source code for SAM CLI. Here is the development team talking about this code:

> SAM CLI code is written in Python. Source code is well documented, very modular, with 95% unit test coverage.
Expand All @@ -59,6 +63,7 @@ We think you'll like the code base. Clone it and run `make pr` or `./Make -pr` o


## Related Repositories and Resources

+ **SAM Transform** [Open source template specification](https://github.com/awslabs/serverless-application-model/) that provides shorthand syntax for CloudFormation
+ **SAM CLI application templates** Get started quickly with [predefined application templates](https://github.com/aws/aws-sam-cli-app-templates/blob/master/README.md) for all supported runtimes and languages, used by `sam init`
+ **Lambda Builders** [Lambda builder tools](https://github.com/aws/aws-lambda-builders) for supported runtimes and custom build workflows, used by `sam build`
Expand Down Expand Up @@ -93,5 +98,7 @@ Source code is located on Github at [awsdocs/aws-sam-developer-guide](https://gi
Read the [SAM Documentation Contribution Guide](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/CONTRIBUTING.md) to get
started.


### Join the SAM Community on Slack

[Join the SAM developers channel (#samdev)](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw) on Slack to collaborate with fellow community members and the AWS SAM team.
2 changes: 1 addition & 1 deletion appveyor-iac-integration-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ install:
# AppVeyor's apt-get cache might be outdated, and the package could potentially be 404.
- sh: "sudo apt-get update"

- sh: "gvm use go1.15"
- sh: "gvm use go1.19"
- sh: "echo $PATH"
- sh: "ls /usr/"
- sh: "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64"
Expand Down
29 changes: 16 additions & 13 deletions appveyor-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ install:
# AppVeyor's apt-get cache might be outdated, and the package could potentially be 404.
- sh: "sudo apt-get update"

- sh: "gvm use go1.15"
- sh: "gvm use go1.19"
- sh: "echo $PATH"
- sh: "ls /usr/"
- sh: "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64"
Expand Down Expand Up @@ -176,11 +176,11 @@ for:
- "pip install -e \".[pre-dev]\""

- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/buildcmd"
- sh: "pytest -vv tests/integration/buildcmd --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

# Set JAVA_HOME to java11
- sh: "JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
- sh: "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java11_in_process"
- sh: "pytest -vv tests/integration/buildcmd/test_build_cmd.py -k test_building_java11_in_process --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java11"

# Integ testing deploy
-
Expand All @@ -191,7 +191,7 @@ for:

test_script:
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/deploy"
- sh: "pytest -vv tests/integration/deploy --json-report --json-report-file=TEST_REPORT-integration-deploy.json"

# Integ testing package
-
Expand All @@ -202,7 +202,7 @@ for:

test_script:
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/package"
- sh: "pytest -vv tests/integration/package --json-report --json-report-file=TEST_REPORT-integration-package.json"

# Integ testing delete
-
Expand All @@ -213,7 +213,7 @@ for:

test_script:
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/delete"
- sh: "pytest -vv tests/integration/delete --json-report --json-report-file=TEST_REPORT-integration-delete.json"

# Integ testing sync
-
Expand All @@ -224,7 +224,7 @@ for:

test_script:
- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/sync"
- sh: "pytest -vv tests/integration/sync --json-report --json-report-file=TEST_REPORT-integration-sync.json"

# Integ testing local
-
Expand All @@ -239,7 +239,7 @@ for:
- "pylint --rcfile .pylintrc samcli"

- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/local"
- sh: "pytest -vv tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-local.json"

# Other testing
-
Expand All @@ -255,15 +255,18 @@ for:

# Dev Tests
- "pip install -e \".[dev]\""
- "pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit"
- "pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit --json-report --json-report-file=TEST_REPORT-unit.json"
- "pylint --rcfile .pylintrc samcli"
- "mypy setup.py samcli tests"
- "pytest -n 4 tests/functional"
- "pytest -n 4 tests/functional --json-report --json-report-file=TEST_REPORT-functional.json"

- sh: "pytest tests/integration --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local"
- sh: "pytest -vv tests/regression"
- sh: "pytest tests/integration --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json"
- sh: "pytest -vv tests/regression --json-report --json-report-file=TEST_REPORT-regression.json"
- sh: "black --check setup.py tests samcli"

# Smoke tests run in parallel - it runs on both Linux & Windows
# Presence of the RUN_SMOKE envvar will run the smoke tests
- ps: "If ($env:RUN_SMOKE) {pytest -n 4 -vv tests/smoke}"
- ps: "If ($env:RUN_SMOKE) {pytest -n 4 -vv tests/smoke --json-report --json-report-file=TEST_REPORT-smoke.json}"

artifacts:
- path: './TEST_REPORT*.json'
24 changes: 14 additions & 10 deletions appveyor-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd"
- ps: "pytest -vv tests/integration/buildcmd --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

#Integ testing deploy
- matrix:
Expand All @@ -149,7 +149,7 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/deploy"
- ps: "pytest -vv tests/integration/deploy --json-report --json-report-file=TEST_REPORT-integration-deploy.json"

# Integ testing package
- matrix:
Expand All @@ -161,7 +161,7 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/package"
- ps: "pytest -vv tests/integration/package --json-report --json-report-file=TEST_REPORT-integration-package.json"

# Integ testing delete
- matrix:
Expand All @@ -173,7 +173,7 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/delete"
- ps: "pytest -vv tests/integration/delete --json-report --json-report-file=TEST_REPORT-integration-delete.json"

# Integ testing sync
- matrix:
Expand All @@ -185,7 +185,7 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/sync"
- ps: "pytest -vv tests/integration/sync --json-report --json-report-file=TEST_REPORT-integration-sync.json"

#Integ testing local
- matrix:
Expand All @@ -197,7 +197,7 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/local"
- ps: "pytest -vv tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-local.json"

#Other testing
- matrix:
Expand All @@ -209,11 +209,15 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit"
- ps: "pytest --cov samcli --cov-report term-missing --cov-fail-under 94 tests/unit --json-report --json-report-file=TEST_REPORT-unit.json"
- "mypy setup.py samcli tests"
- ps: "pytest -n 4 tests/functional"
- ps: "pytest -vv tests/integration --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local"
- ps: "pytest -vv tests/regression"
- ps: "pytest -n 4 tests/functional --json-report --json-report-file=TEST_REPORT-functional.json"
- ps: "pytest -vv tests/integration --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json"
- ps: "pytest -vv tests/regression --json-report --json-report-file=TEST_REPORT-regression.json"
# Uncomment for RDP
# on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

artifacts:
- path: './TEST_REPORT*.json'

2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ for:
# AppVeyor's apt-get cache might be outdated, and the package could potentially be 404.
- sh: "sudo apt-get update"

- sh: "gvm use go1.15"
- sh: "gvm use go1.19"
- sh: "echo $PATH"
- sh: "ls /usr/"
- sh: "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64"
Expand Down
5 changes: 3 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
log_cli = 1
log_cli_level = INFO
addopts = --maxfail=1000 -rf
#filterwarnings =
# error
filterwarnings =
error
ignore::DeprecationWarning:docker
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ boto3>=1.19.5,==1.*
jmespath~=0.10.0
PyYAML~=5.3
cookiecutter~=2.1.1
aws-sam-translator==1.53.0
aws-sam-translator==1.54.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=4.2.0
dateparser~=1.0
requests==2.25.1
serverlessrepo==0.1.10
aws_lambda_builders==1.20.0
aws_lambda_builders==1.21.0
tomlkit==0.7.2
watchdog==2.1.2
pyopenssl==22.0.0
Expand Down
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pytest-xdist==2.1.0
pytest-forked==1.3.0
pytest-timeout==1.4.2
pytest-rerunfailures==9.1.1
pytest-json-report==1.5.0

# formatter
black==22.6.0
Expand Down
14 changes: 7 additions & 7 deletions requirements/reproducible-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ attrs==20.3.0 \
--hash=sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6 \
--hash=sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700
# via jsonschema
aws-lambda-builders==1.20.0 \
--hash=sha256:71b8b2870e735a2e2ac0e59e84295aa967bc8bdb36515feec539b10df2314549 \
--hash=sha256:7c78b9f81a75fae4af3cb958dc0b3b268c12ebe16c3aa5cfd93dcd0c05cefd23
aws-lambda-builders==1.21.0 \
--hash=sha256:77a21d3fa969119b9d05c2a18abd8dd10cff9ee8ba9793932fa00953cefbe4e1 \
--hash=sha256:d79ae58b5d3961f9f55e6645c4759ad9f5455165fb6a7932bf10da39f6d275c0
# via aws-sam-cli (setup.py)
aws-sam-translator==1.53.0 \
--hash=sha256:392ed4f5fb08f72cb68a8800f0bc278d2a3b6609bd1ac66bfcdeaaa94cdc18e5 \
--hash=sha256:84d780ad82f1a176e2f5d4c397749d1e71214cc97ee7cccd50f823fd7c7e7cdf \
--hash=sha256:85252646cf123642d08442137b60445e69e30bfd2f8b663b1202b20ab3782b10
aws-sam-translator==1.54.0 \
--hash=sha256:10d6771ebbe9107a0ddb756ccffd68ba81d885ef2eace80358a098566e6abaf1 \
--hash=sha256:1bb4abb197e6de3f935425e65f67d14f47eb620d984e9de963b666cc9deb66e4 \
--hash=sha256:a3ae79f1f2d430f5ade4d245165d5612414233f540b471d170f1aab95c3713a6
# via aws-sam-cli (setup.py)
backports-zoneinfo==0.2.1 \
--hash=sha256:17746bd546106fa389c51dbea67c8b7c8f0d14b5526a579ca6ccf5ed72c526cf \
Expand Down
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.61.0"
__version__ = "1.62.0"
5 changes: 3 additions & 2 deletions samcli/lib/delete/cfn_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ def wait_for_delete(self, stack_name):

# Wait for Delete to Finish
waiter = self._client.get_waiter("stack_delete_complete")
# Poll every 30 seconds and set max attempts to be 3.
waiter_config = {"Delay": 30, "MaxAttempts": 3}
# Remove `MaxAttempts` from waiter_config.
# Regression: https://github.com/aws/aws-sam-cli/issues/4361
waiter_config = {"Delay": 30}
try:
waiter.wait(StackName=stack_name, WaiterConfig=waiter_config)
except WaiterError as ex:
Expand Down
6 changes: 2 additions & 4 deletions samcli/lib/samlib/resource_metadata_normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,9 @@ def _extract_image_asset_metadata(metadata):
"""
asset_path = Path(metadata.get(ASSET_PATH_METADATA_KEY, ""))
dockerfile_path = Path(metadata.get(ASSET_DOCKERFILE_PATH_KEY), "")
dockerfile, path_from_asset = dockerfile_path.stem, dockerfile_path.parent
dockerfile_context = str(Path(asset_path.joinpath(path_from_asset)))
return {
SAM_METADATA_DOCKERFILE_KEY: dockerfile,
SAM_METADATA_DOCKER_CONTEXT_KEY: dockerfile_context,
SAM_METADATA_DOCKERFILE_KEY: str(dockerfile_path),
SAM_METADATA_DOCKER_CONTEXT_KEY: str(asset_path),
SAM_METADATA_DOCKER_BUILD_ARGS_KEY: metadata.get(ASSET_DOCKERFILE_BUILD_ARGS_KEY, {}),
}

Expand Down
2 changes: 1 addition & 1 deletion samcli/runtime_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app_template_repo_commit": "092491a3e1b4b084be0b78f66fc6a77fc778a709"
"app_template_repo_commit": "1a9655d334bea4de48c611214d17b787d3ea4b3c"
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def read_version():
author_email="aws-sam-developers@amazon.com",
url="https://github.com/awslabs/aws-sam-cli",
license="Apache License 2.0",
packages=find_packages(exclude=["tests.*", "tests"]),
packages=find_packages(exclude=["tests.*", "tests", "installer.*", "installer"]),
keywords="AWS SAM CLI",
# Support Python 3.7 or greater
python_requires=">=3.7, <=4.0, !=4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%YAML 1.1
---
# File: sam.yml
# Version: 0.9

Expand All @@ -16,4 +18,3 @@ Resources:
MemorySize: 1024
Runtime: nodejs12.x
Timeout: 3

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%YAML 1.1
---
# File: sam.yml
# Version: 0.9

Expand Down
Loading

0 comments on commit 883abbc

Please sign in to comment.