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 Aug 17, 2024
2 parents 9e95792 + 89a29b8 commit 651ffbc
Show file tree
Hide file tree
Showing 48 changed files with 3,261 additions and 2,765 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,4 @@ jobs:
- name: Init samdev
run: make init
- name: Run tests without Docker
run: pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_PythonFunctions_WithoutDocker
run: pytest -vv tests/integration/buildcmd/test_build_cmd_python.py -k TestBuildCommand_PythonFunctions_WithoutDocker
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ black-check:
black --check setup.py samcli tests schema

format: black
ruff samcli --fix
ruff check samcli --fix

schema:
python -m schema.make_schema
Expand Down
3 changes: 0 additions & 3 deletions appveyor-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ install:
- sh: "mvn --version"

- sh: "source ${HOME}/venv${PYTHON_VERSION}/bin/activate"
- sh: "rbenv install 3.3.0"
- sh: "rbenv global 3.3.0"
- sh: "ruby --version"
- sh: "docker info"
- sh: "docker version"
- sh: "nvm install ${NODE_VERSION}"
Expand Down
178 changes: 178 additions & 0 deletions appveyor-windows-al2023.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
version: 1.0.{build}
image: ws2022-azure
build: off

clone_folder: C:\source

environment:
AWS_DEFAULT_REGION: us-east-1
SAM_CLI_DEV: 1
CARGO_LAMBDA_VERSION: "v0.17.1"

# Python uses $TMPDIR envvar to find root of tempdir
TMPDIR: "%TEMP%"
TMP: "%TEMP%"

# MSI Installers only use Py3.8. It is sufficient to test with this version here.
PYTHON_HOME: "C:\\Python38-x64"
PYTHON_SCRIPTS: "C:\\Python38-x64\\Scripts"
PYTHON_EXE: "C:\\Python38-x64\\python.exe"
PYTHON_ARCH: "64"
HOME: 'C:\Users\appveyor'
HOMEDRIVE: "C:"
HOMEPATH: 'C:\Users\appveyor'
NOSE_PARAMETERIZED_NO_WARN: 1
AWS_S3: "AWS_S3_TESTING"
AWS_ECR: "AWS_ECR_TESTING"
APPVEYOR_CONSOLE_DISABLE_PTY: true
APPVEYOR_BUILD_WORKER_IMAGE: "ws2022-azure"

init:
# Uncomment this for RDP
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" }
- ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" }
- git config --global core.autocrlf false
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- ps: git config --system core.longpaths true

install:
# upgrade chocolately
- choco upgrade chocolatey
# setup make
- "choco install make"
# setup Java, Maven and Gradle
- choco install correttojdk --version=21.0.0
- 'set JAVA_HOME=C:\Program Files\Amazon Corretto\jdk21.0.0_35'
- 'set PATH=%JAVA_HOME%\bin;%PATH%'
- java --version
- javac --version
- choco upgrade gradle --version=8.4.0
- "gradle -v"
- "mvn --version"

# Make sure the temp directory exists for Python to use.
- ps: "mkdir -Force C:\\tmp"
- 'set PATH=%PYTHON_HOME%;C:\Ruby33-x64\bin;C:\Ruby32-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64'
- "echo %PYTHON_HOME%"
- "echo %PATH%"
- "python --version"
- "ruby --version"
- ps: "Restart-Service docker"
# Switch to Docker Linux containers
- ps: '& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchLinuxEngine'
- "docker info"
- "docker version"

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

# Install Node 20
- ps: "Install-Product node 20"

# Install AWS CLI Globally via pip3
- "pip install awscli"

# Check for git executable
- "git --version"

# Get testing env vars
- ps: "
If (Test-Path env:BY_CANARY){
python -m virtualenv venv_env_vars;
./venv_env_vars/Scripts/pip install boto3;
$test_env_var = ./venv_env_vars/Scripts/python tests/get_testing_resources.py;
$test_env_var_json = ConvertFrom-Json $test_env_var;
$env:CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID = $env:AWS_ACCESS_KEY_ID;
$env:CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY = $env:AWS_SECRET_ACCESS_KEY;
$env:CI_ACCESS_ROLE_AWS_SESSION_TOKEN = $env:AWS_SESSION_TOKEN;
$env:AWS_ACCESS_KEY_ID = $test_env_var_json.accessKeyID;
$env:AWS_SECRET_ACCESS_KEY = $test_env_var_json.secretAccessKey;
$env:AWS_SESSION_TOKEN = $test_env_var_json.sessionToken;
$env:TASK_TOKEN = $test_env_var_json.taskToken;
$env:AWS_S3_TESTING = $test_env_var_json.TestBucketName;
$env:AWS_ECR_TESTING = $test_env_var_json.TestECRURI;
$env:AWS_KMS_KEY = $test_env_var_json.TestKMSKeyArn;
$env:AWS_SIGNING_PROFILE_NAME = $test_env_var_json.TestSigningProfileName;
$env:AWS_SIGNING_PROFILE_VERSION_ARN = $test_env_var_json.TestSigningProfileARN;
}"


# Create new virtual environment with chosen python version and activate it
- "python -m virtualenv venv"
- "venv\\Scripts\\activate"
- "python --version"

# Actually install SAM CLI's dependencies
- 'pip install -e ".[dev]"'

# Install aws cli
- "pip install awscli"

# Echo final Path
- "echo %PATH%"

# use amazon-ecr-credential-helper
- choco install amazon-ecr-credential-helper
- ps: "ls $env:HOME/.docker"
- ps: "
$docker_config = Get-Content $env:HOME/.docker/config.json -raw | ConvertFrom-Json;
$docker_config.credsStore = 'ecr-login';
$docker_config | ConvertTo-Json | set-content $env:HOME/.docker/config.json;
"
- ps: "get-content $env:HOME/.docker/config.json"

# claim some disk space before starting the tests
- "docker system prune -a -f"
# activate virtual environment
- "venv\\Scripts\\activate"



# Final clean up no matter success or failure
on_finish:
# Upload test reports as artifacts
- ps: Get-ChildItem .\TEST_REPORT-*.json | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: '
If (Test-Path env:BY_CANARY){
$env:AWS_ACCESS_KEY_ID = $env:TEST_REPORT_S3_BUCKET_ACCESS_KEY_ID;
$env:AWS_SECRET_ACCESS_KEY = $env:TEST_REPORT_S3_BUCKET_SECRET_ACCESS_KEY;
$env:AWS_SESSION_TOKEN = $env:TEST_REPORT_S3_BUCKET_SESSION_TOKEN;
aws s3 cp ".\" "s3://$env:TEST_REPORT_S3_BUCKET_NAME/appveyor/$env:APPVEYOR_PROJECT_SLUG/$env:APPVEYOR_BUILD_ID/$env:APPVEYOR_JOB_ID/" --recursive --exclude "*" --include "TEST_REPORT-*.json" --region us-west-2
}'

# notify success
- ps: "
If (Test-Path env:BY_CANARY){
$env:AWS_ACCESS_KEY_ID = $env:CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID;
$env:AWS_SECRET_ACCESS_KEY = $env:CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY;
$env:AWS_SESSION_TOKEN = $env:CI_ACCESS_ROLE_AWS_SESSION_TOKEN;
aws stepfunctions send-task-success --task-token \"$env:TASK_TOKEN\" --task-output \"{}\" --region us-west-2;
}"

build_script:
# install Rust in build_script to not override the default "install" actions
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain stable
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- set RUST_BACKTRACE=1
- rustup toolchain install stable --profile minimal --no-self-update
- rustup default stable
- rustup target add x86_64-unknown-linux-gnu --toolchain stable
- rustup target add aarch64-unknown-linux-gnu --toolchain stable
- ps: "choco install zig"
- ps: Invoke-WebRequest -Uri https://github.com/cargo-lambda/cargo-lambda/releases/download/$env:CARGO_LAMBDA_VERSION/cargo-lambda-$env:CARGO_LAMBDA_VERSION.windows-x64.zip -OutFile C:\Users\appveyor\cargo-lambda.zip
- ps: Expand-Archive -DestinationPath C:\Users\appveyor\.cargo\bin C:\Users\appveyor\cargo-lambda.zip
- rustc -V
- cargo -V
- cargo lambda -V

test_script:
- ps: "pytest -vv -n 2 --reruns 3 -m 'al2023' tests/integration/buildcmd --json-report --json-report-file=TEST_REPORT-integration-buildcmd.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'))

13 changes: 4 additions & 9 deletions appveyor-windows-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ init:
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- ps: git config --system core.longpaths true

cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml

install:
# upgrade chocolately
- choco upgrade chocolatey
Expand All @@ -71,7 +67,7 @@ install:

# Make sure the temp directory exists for Python to use.
- ps: "mkdir -Force C:\\tmp"
- 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;%PATH%;C:\Python37-x64;C:\Python39-x64;C:\Python310-x64;C:\Python38-x64;C:\Python312-x64'
- 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python38-x64;C:\Python312-x64'
- "echo %PYTHON_HOME%"
- "echo %PATH%"
- "python --version"
Expand All @@ -84,7 +80,6 @@ install:
# Upgrade setuptools, wheel and virtualenv
- "python -m pip install --upgrade setuptools wheel virtualenv"
# Install pip for the python versions which is used by the tests
- "C:\\Python37-x64\\python.exe -m pip install --upgrade pip"
- "C:\\Python39-x64\\python.exe -m pip install --upgrade pip"
- "C:\\Python310-x64\\python.exe -m pip install --upgrade pip"

Expand Down Expand Up @@ -185,7 +180,7 @@ for:
- configuration: BuildIntegTesting

test_script:
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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"
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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"

- matrix:
only:
Expand All @@ -209,7 +204,7 @@ for:
- cargo lambda -V

test_script:
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'java or python or provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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-java-python-provided.json"
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'java and not al2023 or python and not al2023 or provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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-java-python-provided.json"

#Integ testing build arm64
- matrix:
Expand All @@ -234,7 +229,7 @@ for:
- cargo lambda -V

test_script:
- ps: "pytest -vv --reruns 3 tests/integration/buildcmd/test_build_cmd_arm64.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json"
- ps: "pytest -vv --reruns 3 -m 'not al2023' tests/integration/buildcmd/test_build_cmd_arm64.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json"

#Integ testing Terraform build
- matrix:
Expand Down
9 changes: 4 additions & 5 deletions appveyor-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ install:

# Make sure the temp directory exists for Python to use.
- ps: "mkdir -Force C:\\tmp"
- 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;%PATH%;C:\Python37-x64;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64'
- 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64'
- "echo %PYTHON_HOME%"
- "echo %PATH%"
- "python --version"
Expand All @@ -79,7 +79,6 @@ install:
# Upgrade setuptools, wheel and virtualenv
- "python -m pip install --upgrade setuptools wheel virtualenv"
# Install pip for the python versions which is used by the tests
- "C:\\Python37-x64\\python.exe -m pip install --upgrade pip"
- "C:\\Python39-x64\\python.exe -m pip install --upgrade pip"
- "C:\\Python310-x64\\python.exe -m pip install --upgrade pip"

Expand Down Expand Up @@ -172,7 +171,7 @@ for:
- configuration: BuildIntegTesting

test_script:
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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"
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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"

- matrix:
only:
Expand All @@ -196,7 +195,7 @@ for:
- cargo lambda -V

test_script:
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'java or python or provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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-java-python-provided.json"
- ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'java and not al2023 or python and not al2023 or provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --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-java-python-provided.json"

#Integ testing build arm64
- matrix:
Expand All @@ -221,7 +220,7 @@ for:
- cargo lambda -V

test_script:
- ps: "pytest -vv --reruns 3 tests/integration/buildcmd/test_build_cmd_arm64.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json"
- ps: "pytest -vv --reruns 3 -m 'not al2023' tests/integration/buildcmd/test_build_cmd_arm64.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json"

#Integ testing Terraform build
- matrix:
Expand Down
7 changes: 4 additions & 3 deletions installer/pyinstaller/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ "$python_version" = "" ]; then
fi

if [ "$openssl_version" = "" ]; then
openssl_version="1.1.1w";
openssl_version="3.0.14";
fi

if [ "$zlib_version" = "" ]; then
Expand All @@ -38,7 +38,7 @@ fi

set -eux

yum install -y libffi-devel
yum install -y libffi-devel perl-IPC-Cmd

echo "Making Folders"
mkdir -p .build/src
Expand All @@ -49,11 +49,12 @@ mkdir -p .build/output/openssl
cd .build/output/openssl

echo "Building OpenSSL"
curl -L "https://github.com/openssl/openssl/releases/download/OpenSSL_${openssl_version//./_}/openssl-${openssl_version}.tar.gz" --output openssl.tar.gz
curl -L "https://github.com/openssl/openssl/releases/download/openssl-${openssl_version}/openssl-${openssl_version}.tar.gz" --output openssl.tar.gz
tar xzf openssl.tar.gz
cd openssl-${openssl_version}
# install_sw installs OpenSSL without manual pages
./config --prefix=/opt/openssl && make -j8 && make -j8 install_sw
ln -sf /opt/openssl/lib64 /opt/openssl/lib
cd ../../

echo "Building zlib"
Expand Down
2 changes: 1 addition & 1 deletion installer/pyinstaller/build-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ "$python_library_zip_filename" = "" ]; then
fi

if [ "$openssl_version" = "" ]; then
openssl_version="1.1.1w";
openssl_version="3.0.14";
fi

if [ "$python_version" = "" ]; then
Expand Down
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ ignore_missing_imports=True
[mypy-watchdog,watchdog.*]
ignore_missing_imports=True

[mypy-cfnlint,cfnlint.*]
ignore_missing_imports=True

# progressive add typechecks and these modules already complete the process, let's keep them clean
[mypy-samcli.lib.iac.plugins_interfaces,samcli.commands.build,samcli.lib.build.*,samcli.commands.local.cli_common.invoke_context,samcli.commands.local.lib.local_lambda,samcli.lib.providers.*,samcli.lib.utils.git_repo.py,samcli.lib.cookiecutter.*,samcli.lib.pipeline.*,samcli.commands.pipeline.*]
disallow_untyped_defs=True
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ markers =
python
provided
dotnet
al2023: Marker to note tests that require a newer Docker version on Windows
10 changes: 5 additions & 5 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Flask<3.1
boto3>=1.29.2,<2
jmespath~=1.0.1
ruamel_yaml~=0.18.6
PyYAML~=6.0,>=6.0.1
PyYAML~=6.0
cookiecutter~=2.6.0
aws-sam-translator==1.89.0
aws-sam-translator==1.90.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=7.1.0
dateparser~=1.2
requests~=2.32.3
aws_lambda_builders==1.50.0
tomlkit==0.13.0
watchdog==4.0.1
watchdog==4.0.2
rich~=13.7.1
pyopenssl~=24.2.1
# Pin to <4.18 to until SAM-T no longer uses RefResolver
Expand All @@ -28,7 +28,7 @@ regex!=2021.10.8
tzlocal==5.2

#Adding cfn-lint dependency for SAM validate
cfn-lint~=0.87.7
cfn-lint~=1.10.0

# Type checking boto3 objects
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.147
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.159
Loading

0 comments on commit 651ffbc

Please sign in to comment.