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 14, 2022
2 parents 883abbc + 960c916 commit bfdfd3a
Show file tree
Hide file tree
Showing 398 changed files with 23,093 additions and 498 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ omit =
# TODO: Remove the plugins_interfaces.py omission when new interfaces are used
samcli/lib/iac/plugins_interfaces.py
samcli/lib/init/templates/*
samcli/hook_packages/terraform/copy_terraform_built_artifacts.py
[report]
exclude_lines =
pragma: no cover
Expand Down
85 changes: 84 additions & 1 deletion appveyor-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ image:

configuration:
- BuildIntegTesting
- LocalZipTerraformBuildIntegTesting
- LocalZipTerraformBuildInContainerIntegTesting
- S3ZipTerraformBuildIntegTesting
- S3ZipTerraformBuildInContainerIntegTesting
- OtherTerraformBuildIntegTesting
- DeployIntegTesting
- PackageIntegTesting
- DeleteIntegTesting
Expand Down Expand Up @@ -109,6 +114,14 @@ install:
# get testing env vars
- sh: "sudo apt install -y jq"

# install Terraform
- sh: "sudo apt update"
- sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`"
- sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp"
- sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip"
- sh: "sudo mv /opt/terraform/terraform /usr/local/bin/"
- sh: "terraform -version"

- sh: "python3.9 -m venv .venv_env_vars"
- sh: ".venv_env_vars/bin/pip install boto3"
- sh: "test_env_var=$(.venv_env_vars/bin/python tests/get_testing_resources.py)"
Expand Down Expand Up @@ -176,12 +189,82 @@ for:
- "pip install -e \".[pre-dev]\""

- "pip install -e \".[dev]\""
- sh: "pytest -vv tests/integration/buildcmd --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
- sh: "pytest -vv tests/integration/buildcmd --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --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 --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java11"

# Local ZIP Terraform Build integ testing
-
matrix:
only:
- image: Ubuntu
configuration: LocalZipTerraformBuildIntegTesting

test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""

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

# Local ZIP Terraform Build In Container integ testing
-
matrix:
only:
- image: Ubuntu
configuration: LocalZipTerraformBuildInContainerIntegTesting

test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""

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

# S3 ZIP Terraform Build integ testing
-
matrix:
only:
- image: Ubuntu
configuration: S3ZipTerraformBuildIntegTesting

test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""

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

# S3 ZIP Terraform Build In Container integ testing
-
matrix:
only:
- image: Ubuntu
configuration: S3ZipTerraformBuildInContainerIntegTesting

test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""

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

# Other Terraform Build In Container integ testing
-
matrix:
only:
- image: Ubuntu
configuration: OtherTerraformBuildIntegTesting

test_script:
# Pre-dev Tests
- "pip install -e \".[pre-dev]\""

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

# Integ testing deploy
-
matrix:
Expand Down
76 changes: 71 additions & 5 deletions appveyor-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ clone_folder: C:\source

configuration:
- BuildIntegTesting
- LocalZipTerraformBuildIntegTesting
- LocalZipTerraformBuildInContainerIntegTesting
- S3ZipTerraformBuildIntegTesting
- S3ZipTerraformBuildInContainerIntegTesting
- OtherTerraformBuildIntegTesting
- DeployIntegTesting
- PackageIntegTesting
- DeleteIntegTesting
Expand Down Expand Up @@ -60,6 +65,10 @@ install:
- "python --version"
- "docker info"

# install Terraform CLI
- "choco install terraform"
- "terraform -version"

# Upgrade setuptools, wheel and virtualenv
- "python -m pip install --upgrade setuptools wheel virtualenv"

Expand Down Expand Up @@ -110,10 +119,7 @@ install:
# Echo final Path
- "echo %PATH%"

- ps: "
If (Test-Path env:BY_CANARY){
echo Logging in Public ECR; aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws;
}"
- "IF DEFINED BY_CANARY ECHO Logging in Public ECR && aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws"

# Final clean up no matter success or failure
on_finish:
Expand All @@ -137,7 +143,67 @@ for:
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"
- ps: "pytest -vv tests/integration/buildcmd --ignore tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

# Local ZIP Terraform Build integ testing
- matrix:
only:
- configuration: LocalZipTerraformBuildIntegTesting

test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndLocalBackend_0 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

# Local ZIP Terraform Build In Container integ testing
- matrix:
only:
- configuration: LocalZipTerraformBuildInContainerIntegTesting

test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndLocalBackend_1 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

# S3 ZIP Terraform Build integ testing
- matrix:
only:
- configuration: S3ZipTerraformBuildIntegTesting

test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndS3Backend_0 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

# S3 ZIP Terraform Build In Container integ testing
- matrix:
only:
- configuration: S3ZipTerraformBuildInContainerIntegTesting

test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv tests/integration/buildcmd/test_build_terraform_applications.py::TestBuildTerraformApplicationsWithZipBasedLambdaFunctionAndS3Backend_1 --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

# Other Terraform Build integ testing
- matrix:
only:
- configuration: OtherTerraformBuildIntegTesting

test_script:
# Reactivate virtualenv before running tests
- "git --version"
- "venv\\Scripts\\activate"
- "docker system prune -a -f"
- ps: "pytest -vv -n 4 tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json"

#Integ testing deploy
- matrix:
Expand Down
12 changes: 12 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ for:
- "python -m pip install --upgrade setuptools wheel virtualenv"
- "docker info"

# install Terraform CLI
- "choco install terraform"
- "terraform -version"

# Install AWS CLI Globally outside of a venv.
- "pip install awscli"

Expand Down Expand Up @@ -141,6 +145,14 @@ for:
- sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip"
- sh: "PATH=/opt/gradle/gradle-5.5/bin:$PATH"

# install Terraform
- sh: "sudo apt update"
- sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`"
- sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp"
- sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip"
- sh: "sudo mv /opt/terraform/terraform /usr/local/bin/"
- sh: "terraform -version"

# Install AWS CLI
- sh: "virtualenv aws_cli"
- sh: "./aws_cli/bin/python -m pip install awscli"
Expand Down
5 changes: 4 additions & 1 deletion installer/pyinstaller/hook-samcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
hiddenimports = SAM_CLI_HIDDEN_IMPORTS

datas = (
hooks.collect_data_files("samcli")
hooks.collect_all(
"samcli", include_py_files=True, include_datas=["hook_packages/terraform/copy_terraform_built_artifacts.py"]
)[0]
+ hooks.collect_data_files("samcli")
+ hooks.collect_data_files("samtranslator")
+ hooks.collect_data_files("aws_lambda_builders")
+ hooks.collect_data_files("text_unidecode")
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ addopts = --maxfail=1000 -rf
filterwarnings =
error
ignore::DeprecationWarning:docker
default::ResourceWarning
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.62.0"
__version__ = "1.63.0"
1 change: 1 addition & 0 deletions samcli/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def callback(ctx, param, value):
return click.option(
"--debug",
expose_value=False,
is_eager=True,
is_flag=True,
envvar="SAM_DEBUG",
help="Turn on debug logging to print debug message generated by SAM CLI and display timestamps.",
Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/_utils/command_exception_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from botocore.exceptions import NoRegionError, ClientError

from samcli.commands._utils.options import parameterized_option
from samcli.commands._utils.parameterized_option import parameterized_option
from samcli.commands.exceptions import CredentialsError, RegionError
from samcli.lib.utils.boto_utils import get_client_error_code

Expand Down
10 changes: 10 additions & 0 deletions samcli/commands/_utils/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
SAM CLI Default Build constants
"""
import os

DEFAULT_STACK_NAME = "sam-app"
DEFAULT_BUILD_DIR = os.path.join(".aws-sam", "build")
DEFAULT_BUILD_DIR_WITH_AUTO_DEPENDENCY_LAYER = os.path.join(".aws-sam", "auto-dependency-layer")
DEFAULT_CACHE_DIR = os.path.join(".aws-sam", "cache")
DEFAULT_BUILT_TEMPLATE_PATH = os.path.join(".aws-sam", "build", "template.yaml")
Loading

0 comments on commit bfdfd3a

Please sign in to comment.