Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Gama committed Jun 22, 2023
2 parents 3bc17e7 + 4709d13 commit ae8dbaa
Show file tree
Hide file tree
Showing 90 changed files with 1,272 additions and 331 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ jobs:
- "3.11"
steps:
- uses: actions/checkout@v3
# @melasmar
# TODO: Revert back to use 3.7 to all operating systems after the regression issue in Python
# https://github.com/actions/setup-python/issues/682 in github action got resolved
- uses: actions/setup-python@v4
if: matrix.os != 'macos-latest' || ( matrix.os == 'macos-latest' && matrix.python != '3.7' )
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-python@v4
if: matrix.os == 'macos-latest' && matrix.python == '3.7'
with:
python-version: "3.7.16"
- run: test -f "./.github/ISSUE_TEMPLATE/Bug_report.md" # prevent Bug_report.md from being renamed or deleted
- run: make init
- run: make pr
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/validate_pyinstaller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- develop

env:
CI_OVERRIDE: "1"

jobs:
build-for-linux:
name: build-pyinstaller-linux
Expand All @@ -15,15 +18,20 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Build PyInstaller
run: |
chmod +x ./installer/pyinstaller/build-linux.sh
CI_OVERRIDE=1 ./installer/pyinstaller/build-linux.sh aws-sam-cli-linux-x86_64.zip
./installer/pyinstaller/build-linux.sh aws-sam-cli-linux-x86_64.zip
- name: Basic tests for PyInstaller
run: |
unzip .build/output/aws-sam-cli-linux-x86_64.zip -d sam-installation
./sam-installation/install
sam-beta --version
./tests/sanity-check.sh
- uses: actions/upload-artifact@v3
with:
name: pyinstaller-linux-zip
Expand All @@ -41,15 +49,20 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Build PyInstaller
run: |
chmod +x ./installer/pyinstaller/build-mac.sh
CI_OVERRIDE=1 ./installer/pyinstaller/build-mac.sh aws-sam-cli-macos-x86_64.zip
./installer/pyinstaller/build-mac.sh aws-sam-cli-macos-x86_64.zip
- name: Basic tests for PyInstaller
run: |
unzip .build/output/aws-sam-cli-macos-x86_64.zip -d sam-installation
sudo ./sam-installation/install
sam-beta --version
./tests/sanity-check.sh
- uses: actions/upload-artifact@v3
with:
name: pyinstaller-macos-zip
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,6 @@ coverage.xml

# Temporary scratch directory used by the tests
tests/integration/buildcmd/scratch
tests/integration/testdata/buildcmd/Dotnetcore2.0/bin
tests/integration/testdata/buildcmd/Dotnetcore2.0/obj
tests/integration/testdata/buildcmd/Dotnetcore2.1/bin
tests/integration/testdata/buildcmd/Dotnetcore2.1/obj
tests/integration/testdata/buildcmd/Dotnetcore3.1/bin
tests/integration/testdata/buildcmd/Dotnetcore3.1/obj
tests/integration/testdata/buildcmd/Dotnet6/bin
tests/integration/testdata/buildcmd/Dotnet6/obj
tests/integration/testdata/buildcmd/Dotnet7/bin
Expand Down
4 changes: 2 additions & 2 deletions appveyor-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ environment:

install:
# AppVeyor's apt-get cache might be outdated, and the package could potentially be 404.
- sh: "sudo apt-get update"
- sh: "sudo apt-get update --allow-releaseinfo-change"

- sh: "gvm use go1.19"
- sh: "echo $PATH"
Expand Down Expand Up @@ -87,7 +87,7 @@ install:
- sh: "sudo apt install -y jq"

# install Terraform
- sh: "sudo apt update"
- sh: "sudo apt update --allow-releaseinfo-change"
- 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"
Expand Down
2 changes: 1 addition & 1 deletion designs/build_debug_artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ We will introduce a way in `sam build` to produce these debuggable artifacts for
Success criteria for the change
-------------------------------

1. Artifacts generated will be debuggable for runtimes DotNetCore 2.0 and above.
1. Artifacts generated will be debuggable for runtimes DotNet 6.0 and above.

Out-of-Scope
------------
Expand Down
2 changes: 1 addition & 1 deletion designs/sam_build_cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ build actions. This section will look like:
"build": {
"actions": {
"java8": "gradle build",
"dotnetcore2.1": "./build.sh"
"dotnet6": "./build.sh"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jmespath~=1.0.1
ruamel_yaml~=0.17.21
PyYAML>=5.4.1,==5.*
cookiecutter~=2.1.1
aws-sam-translator==1.68.0
aws-sam-translator==1.69.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=6.1.0
dateparser~=1.1
Expand All @@ -28,4 +28,4 @@ regex!=2021.10.8
tzlocal==3.0

#Adding cfn-lint dependency for SAM validate
cfn-lint~=0.77.5
cfn-lint~=0.77.9
12 changes: 6 additions & 6 deletions requirements/reproducible-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ aws-lambda-builders==1.34.0 \
--hash=sha256:0790f7e9b7ee7286b96fbcf49450c5be0341bb7cb852ca7d74beae190139eb48 \
--hash=sha256:20456a942a417407b42ecf8ab7fce6a47306fd063051e7cb09d02d1be24d5cf3
# via aws-sam-cli (setup.py)
aws-sam-translator==1.68.0 \
--hash=sha256:557d8080c9e6c1c609bfe806ea9545f7ea34144e2466c0ddc801806c2c05afdc \
--hash=sha256:d12a7bb3909142d32458f76818cb96a5ebc5f50fbd5943301d552679a893afcc
aws-sam-translator==1.69.0 \
--hash=sha256:bf26c061675f20367e87d48963ada1ec983a8d897e85db02d0f35913a6174bb0 \
--hash=sha256:c6ed7a25c77d30d3d31156049415d15fde46c0d3b77a4c5cdc0ef8b53ba9bca2
# via
# aws-sam-cli (setup.py)
# cfn-lint
Expand Down Expand Up @@ -112,9 +112,9 @@ cffi==1.15.1 \
--hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \
--hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0
# via cryptography
cfn-lint==0.77.5 \
--hash=sha256:4282d13ffe76a5dee6431b1f56e3641d87c28b1ef5be663afe7d8dbf13f28bdb \
--hash=sha256:b5126dffb834078a71341090d49669046076c09196f0d2bdca68dbace1bf357a
cfn-lint==0.77.9 \
--hash=sha256:7c1e631b723b521234d92d4081934291b256dba28d723ddb7ff105215fe40020 \
--hash=sha256:f95b503f7465ee1f2f89ddf32289ea03a517f08c366bb8e6a5d6773a11e5a1aa
# via aws-sam-cli (setup.py)
chardet==5.1.0 \
--hash=sha256:0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5 \
Expand Down
12 changes: 6 additions & 6 deletions requirements/reproducible-mac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ aws-lambda-builders==1.34.0 \
--hash=sha256:0790f7e9b7ee7286b96fbcf49450c5be0341bb7cb852ca7d74beae190139eb48 \
--hash=sha256:20456a942a417407b42ecf8ab7fce6a47306fd063051e7cb09d02d1be24d5cf3
# via aws-sam-cli (setup.py)
aws-sam-translator==1.68.0 \
--hash=sha256:557d8080c9e6c1c609bfe806ea9545f7ea34144e2466c0ddc801806c2c05afdc \
--hash=sha256:d12a7bb3909142d32458f76818cb96a5ebc5f50fbd5943301d552679a893afcc
aws-sam-translator==1.69.0 \
--hash=sha256:bf26c061675f20367e87d48963ada1ec983a8d897e85db02d0f35913a6174bb0 \
--hash=sha256:c6ed7a25c77d30d3d31156049415d15fde46c0d3b77a4c5cdc0ef8b53ba9bca2
# via
# aws-sam-cli (setup.py)
# cfn-lint
Expand Down Expand Up @@ -130,9 +130,9 @@ cffi==1.15.1 \
--hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \
--hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0
# via cryptography
cfn-lint==0.77.5 \
--hash=sha256:4282d13ffe76a5dee6431b1f56e3641d87c28b1ef5be663afe7d8dbf13f28bdb \
--hash=sha256:b5126dffb834078a71341090d49669046076c09196f0d2bdca68dbace1bf357a
cfn-lint==0.77.9 \
--hash=sha256:7c1e631b723b521234d92d4081934291b256dba28d723ddb7ff105215fe40020 \
--hash=sha256:f95b503f7465ee1f2f89ddf32289ea03a517f08c366bb8e6a5d6773a11e5a1aa
# via aws-sam-cli (setup.py)
chardet==5.1.0 \
--hash=sha256:0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5 \
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.87.0"
__version__ = "1.88.0"
7 changes: 6 additions & 1 deletion samcli/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"samcli.commands.pipeline.pipeline",
"samcli.commands.list.list",
"samcli.commands.docs",
# "samcli.commands.remote.remote",
"samcli.commands.remote.remote",
# We intentionally do not expose the `bootstrap` command for now. We might open it up later
# "samcli.commands.bootstrap",
]
Expand Down Expand Up @@ -173,6 +173,11 @@ def format_commands(self, ctx: click.Context, formatter: RootCommandHelpTextForm
text=SAM_CLI_COMMANDS.get("sync", ""),
extra_row_modifiers=[HighlightNewRowNameModifier()],
),
RowDefinition(
name="remote",
text=SAM_CLI_COMMANDS.get("remote", ""),
extra_row_modifiers=[HighlightNewRowNameModifier()],
),
],
)

Expand Down
1 change: 1 addition & 0 deletions samcli/cli/root/command_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"validate": "Validate an AWS SAM template.",
"build": "Build your AWS serverless function code.",
"local": "Run your AWS serverless function locally.",
"remote": "Invoke or send an event to cloud resources in your CFN stack",
"package": "Package an AWS SAM application.",
"deploy": "Deploy an AWS SAM application.",
"delete": "Delete an AWS SAM application and the artifacts created by sam deploy.",
Expand Down
8 changes: 7 additions & 1 deletion samcli/commands/_utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,13 @@ def remote_invoke_parameter_click_option():
type=RemoteInvokeBotoApiParameterType(),
callback=remote_invoke_boto_parameter_callback,
required=False,
help="Additional parameters for the boto API call.\n" "Lambda APIs: invoke and invoke_with_response_stream",
help="Additional parameters that can be passed to invoke the resource.\n"
"The following additional parameters can be used to invoke a lambda resource and get a buffered response: "
"InvocationType='Event'|'RequestResponse'|'DryRun', LogType='None'|'Tail', "
"ClientContext='base64-encoded string' Qualifier='string'. "
"The following additional parameters can be used to invoke a lambda resource with response streaming: "
"InvocationType='RequestResponse'|'DryRun', LogType='None'|'Tail', "
"ClientContext='base64-encoded string', Qualifier='string'.",
)


Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/build/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
2. Nodejs 18.x, 16.x, 14.x, 12.x using NPM\n
3. Ruby 2.7, 3.2 using Bundler\n
4. Java 8, Java 11, Java 17 using Gradle and Maven\n
5. Dotnetcore 3.1, Dotnet6 using Dotnet CLI (without --use-container)\n
5. Dotnet6 using Dotnet CLI (without --use-container)\n
6. Go 1.x using Go Modules (without --use-container)\n
"""

Expand Down
8 changes: 4 additions & 4 deletions samcli/commands/init/init_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ def get_preprocessed_manifest(
"""
This method get the manifest cloned from the git repo and preprocessed it.
Below is the link to manifest:
https://github.com/aws/aws-sam-cli-app-templates/blob/master/manifest.json
https://github.com/aws/aws-sam-cli-app-templates/blob/master/manifest-v2.json
The structure of the manifest is shown below:
{
"dotnetcore3.1": [
"dotnet6": [
{
"directory": "dotnetcore3.1/cookiecutter-aws-sam-hello-dotnet",
"directory": "dotnet6/hello",
"displayName": "Hello World Example",
"dependencyManager": "cli-package",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Serverless API"
"useCaseName": "Hello World Example"
},
]
}
Expand Down
42 changes: 30 additions & 12 deletions samcli/commands/remote/invoke/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
from samcli.cli.context import Context
from samcli.cli.main import aws_creds_options, common_options, pass_context, print_cmdline_args
from samcli.cli.types import RemoteInvokeOutputFormatType
from samcli.commands._utils.command_exception_handler import command_exception_handler
from samcli.commands._utils.options import remote_invoke_parameter_option
from samcli.commands.remote.invoke.core.command import RemoteInvokeCommand
from samcli.lib.cli_validation.remote_invoke_options_validations import (
event_and_event_file_options_validation,
stack_name_or_resource_id_atleast_one_option_validation,
Expand All @@ -20,30 +22,45 @@
LOG = logging.getLogger(__name__)

HELP_TEXT = """
Invoke or send an event to cloud resources in your CFN stack
Invoke or send an event to resources in the cloud.
"""
SHORT_HELP = "Invoke a deployed resource in the cloud"

DESCRIPTION = """
Invoke or send an event to resources in the cloud.
An event body can be passed using either -e (--event) or --event-file parameter.
Returned response will be written to stdout. Lambda logs will be written to stderr.
"""


@click.command("invoke", help=HELP_TEXT, short_help=SHORT_HELP)
@click.command(
"invoke",
cls=RemoteInvokeCommand,
help=HELP_TEXT,
description=DESCRIPTION,
short_help=SHORT_HELP,
requires_credentials=True,
context_settings={"max_content_width": 120},
)
@configuration_option(provider=ConfigProvider(section="parameters"))
@click.option("--stack-name", required=False, help="Name of the stack to get the resource information from")
@click.option("--resource-id", required=False, help="Name of the resource that will be invoked")
@click.argument("resource-id", required=False)
@click.option(
"--event",
"-e",
help="The event that will be sent to the resource. The target parameter will depend on the resource type. "
"For instance: 'Payload' for Lambda",
"For instance: 'Payload' for Lambda which can be passed as a JSON string",
)
@click.option(
"--event-file",
type=click.File("r", encoding="utf-8"),
help="The file that contains the event that will be sent to the resource",
help="The file that contains the event that will be sent to the resource.",
)
@click.option(
"--output-format",
help="Output format for the boto API response",
default=RemoteInvokeOutputFormat.DEFAULT.name.lower(),
"--output",
help="Output the results from the command in a given output format. "
"The text format prints a readable AWS API response. The json format prints the full AWS API response.",
default=RemoteInvokeOutputFormat.TEXT.name.lower(),
type=RemoteInvokeOutputFormatType(RemoteInvokeOutputFormat),
)
@remote_invoke_parameter_option
Expand All @@ -55,13 +72,14 @@
@track_command
@check_newer_version
@print_cmdline_args
@command_exception_handler
def cli(
ctx: Context,
stack_name: str,
resource_id: str,
event: str,
event_file: TextIOWrapper,
output_format: RemoteInvokeOutputFormat,
output: RemoteInvokeOutputFormat,
parameter: dict,
config_file: str,
config_env: str,
Expand All @@ -75,7 +93,7 @@ def cli(
resource_id,
event,
event_file,
output_format,
output,
parameter,
ctx.region,
ctx.profile,
Expand All @@ -89,7 +107,7 @@ def do_cli(
resource_id: str,
event: str,
event_file: TextIOWrapper,
output_format: RemoteInvokeOutputFormat,
output: RemoteInvokeOutputFormat,
parameter: dict,
region: str,
profile: str,
Expand Down Expand Up @@ -120,7 +138,7 @@ def do_cli(
) as remote_invoke_context:

remote_invoke_input = RemoteInvokeExecutionInfo(
payload=event, payload_file=event_file, parameters=parameter, output_format=output_format
payload=event, payload_file=event_file, parameters=parameter, output_format=output
)

remote_invoke_context.run(remote_invoke_input=remote_invoke_input)
Expand Down
Empty file.
Loading

0 comments on commit ae8dbaa

Please sign in to comment.