forked from aws/aws-sam-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
1,351 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
area/package: | ||
- samcli/commands/package/* | ||
- samcli/commands/package/**/* | ||
|
||
area/local/invoke: | ||
- samcli/commands/local/invoke/* | ||
- samcli/commands/local/invoke/**/* | ||
- samcli/local/* | ||
- samcli/local/**/* | ||
|
||
area/pipeline: | ||
- samcli/commands/pipeline/* | ||
- samcli/commands/pipeline/**/* | ||
|
||
area/deploy: | ||
- samcli/commands/deploy/* | ||
- samcli/commands/deploy/**/* | ||
|
||
area/local/start-api: | ||
- samcli/commands/local/start-api/* | ||
- samcli/commands/local/start-api/**/* | ||
- samcli/local/* | ||
- samcli/local/**/* | ||
|
||
area/local/start-invoke: | ||
- samcli/commands/local/start-invoke/* | ||
- samcli/commands/local/start-invoke/**/* | ||
- samcli/local/* | ||
- samcli/local/**/* | ||
|
||
area/local/generate-event: | ||
- samcli/commands/local/generate-event/* | ||
- samcli/commands/local/generate-event/**/* | ||
|
||
area/init: | ||
- samcli/commands/init/* | ||
- samcli/commands/init/**/* | ||
|
||
area/delete: | ||
- samcli/commands/delete/* | ||
- samcli/commands/delete/**/* | ||
|
||
area/integration-tests: | ||
- test/integration/* | ||
- test/integration/**/* | ||
|
||
area/publish: | ||
- samcli/commands/publish/* | ||
- samcli/commands/publish/**/* | ||
|
||
area/sync: | ||
- samcli/commands/sync/* | ||
- samcli/commands/sync/**/* | ||
|
||
area/validate: | ||
- samcli/commands/validate/* | ||
- samcli/commands/validate/**/* | ||
|
||
area/build: | ||
- samcli/commands/build/* | ||
- samcli/commands/build/**/* | ||
- samcli/lib/build/* | ||
- samcli/lib/build/**/* | ||
|
||
area/logs: | ||
- samcli/commands/logs/* | ||
- samcli/commands/logs/**/* | ||
|
||
area/traces: | ||
- samcli/commands/traces/* | ||
- samcli/commands/traces/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This folder has Github Actions for this repo. | ||
|
||
** pr-labler ** | ||
|
||
This is responsible for tagging our prs automattically. The primary thing it does is tags internal vs external (to the team) PRs. It will | ||
also tag PRs with `area/*` tags based upon the files being changes in the PR. This is run on `pull_request_target` which only runs what is | ||
in the repo not what is in the Pull Request. This is done to help guard against a PR running and changing. For this, the Action should NEVER | ||
download or checkout the PR. It is purely for tagging/labeling not CI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: "Pull Request Labeler" | ||
on: | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
apply-file-based-labels: | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/labeler@v3 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
apply-internal-external-label: | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const maintainers = ['jfuss', 'c2tarun', 'hoffa', 'awood45', 'CoshUS', 'aahung', 'hawflau', 'mndeveci', 'ssenchenko', 'wchengru', 'mingkun2020', 'qingchm', 'moelasmar', 'xazhao', 'mildaniel', 'marekaiv', 'torresxb1'] | ||
if (maintainers.includes(context.payload.sender.login)) { | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['pr/internal'] | ||
}) | ||
} else { | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['pr/external'] | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ pytest-timeout==1.4.2 | |
pytest-rerunfailures==9.1.1 | ||
|
||
# formatter | ||
black==20.8b1 | ||
black==21.10b0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
SAM CLI version | ||
""" | ||
|
||
__version__ = "1.35.0" | ||
__version__ = "1.36.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
""" | ||
Parsing utilities commonly used to process information for commands | ||
""" | ||
import logging | ||
from typing import Optional, Dict, Tuple | ||
|
||
from samcli.commands.exceptions import InvalidImageException | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def process_env_var(container_env_var: Optional[Tuple[str]]) -> Dict: | ||
""" | ||
Parameters | ||
---------- | ||
container_env_var : Tuple | ||
the tuple of command line env vars received from --container-env-var flag | ||
Each input format needs to be either function specific format (FuncName.VarName=Value) | ||
or global format (VarName=Value) | ||
Returns | ||
------- | ||
dictionary | ||
Processed command line environment variables | ||
""" | ||
processed_env_vars: Dict = {} | ||
|
||
if container_env_var: | ||
for env_var in container_env_var: | ||
location_key = "Parameters" | ||
|
||
env_var_name, value = _parse_key_value_pair(env_var) | ||
|
||
if not env_var_name or not value: | ||
LOG.error("Invalid command line --container-env-var input %s, skipped", env_var) | ||
continue | ||
|
||
if "." in env_var_name: | ||
location_key, env_var_name = env_var_name.split(".", 1) | ||
if not location_key.strip() or not env_var_name.strip(): | ||
LOG.error("Invalid command line --container-env-var input %s, skipped", env_var) | ||
continue | ||
|
||
if not processed_env_vars.get(location_key): | ||
processed_env_vars[location_key] = {} | ||
processed_env_vars[location_key][env_var_name] = value | ||
|
||
return processed_env_vars | ||
|
||
|
||
def process_image_options(image_args: Optional[Tuple[str]]) -> Dict: | ||
""" | ||
Parameters | ||
---------- | ||
image_args : Tuple | ||
Tuple of command line image options in the format of | ||
"Function1=public.ecr.aws/abc/abc:latest" or | ||
"public.ecr.aws/abc/abc:latest" | ||
Returns | ||
------- | ||
dictionary | ||
Function as key and the corresponding image URI as value. | ||
Global default image URI is contained in the None key. | ||
""" | ||
images: Dict[Optional[str], str] = dict() | ||
if image_args: | ||
for image_string in image_args: | ||
function_name, image_uri = _parse_key_value_pair(image_string) | ||
if not image_uri: | ||
raise InvalidImageException(f"Invalid command line image input {image_string}.") | ||
images[function_name] = image_uri | ||
|
||
return images | ||
|
||
|
||
def _parse_key_value_pair(arg: str) -> Tuple[Optional[str], str]: | ||
""" | ||
Parameters | ||
---------- | ||
arg : str | ||
Arg in the format of "Value" or "Key=Value" | ||
Returns | ||
------- | ||
key : Optional[str] | ||
If key is not specified, None will be the key. | ||
value : str | ||
""" | ||
key: Optional[str] | ||
value: str | ||
if "=" in arg: | ||
parts = arg.split("=", 1) | ||
key = parts[0].strip() | ||
value = parts[1].strip() | ||
else: | ||
key = None | ||
value = arg.strip() | ||
return key, value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.