-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for --no-use-container option #7745
Conversation
|
||
LOG.debug(Path(config_path).read_text()) | ||
runner = CliRunner() | ||
result = runner.invoke(cli, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you probably want to check here is that the parameter in the command line gets picked up (--no-use-container
, that you're adding). To test that, you need to pass it in this part. Like this line.
Otherwise, you're just testing that the samconfig works fine, not the command line argument. (Probably the same for sync below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both tests are different. The use cases in the link you provided focus on testing overrides. For example, if my configuration includes "use_container": True
, I can pass --no-use-container
to override it, effectively setting "use_container": False
.
This is a draft PR to validate whether make schema works. Please note that the PR is not complete as you review it. I have unit test coverage for overrides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could have 1 unit test for testing the default config value as here and another one like @valerena mentioned about with use-container=True
and override it with --no-use-container
to assert it gets set to False
. The sam sync
test below could be updated with the latter case since both cases stem from the same click option anyways (we might not need duplicate tests for each command).
@@ -849,8 +849,10 @@ def resolve_image_repos_option(f): | |||
|
|||
def use_container_build_click_option(): | |||
return click.option( | |||
"--use-container", | |||
"--use-container/--no-use-container", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If customer doesn't specify --use-container
or --no-use-container
, will sam cli still use the value from samconfig.toml after this change? E.g. If samconfig.toml has use_container=true
, and customer run sam build
without any flag, it should continue to use container to build right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation might help answer your question: SAM CLI Configuration File Precedence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if customer has use_container=true
in sam config.toml, Will sam build --no-use-container --save-params
update use_container=true
in samconfig.toml to use_container=false
?
yes |
"-u", | ||
required=False, | ||
default=False, | ||
is_flag=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking, is_flag
could be removed after this change.
closing this pr in favor of #7769 due to inability to rebase locally. |
Why is this change necessary?
use-container
currently doesn't have an opposite option calledno-use-container
, user wants to use the IDE toolkit which depends on samcli to set default behaviors but still wants the flexibility of using the opposite option to carry out different operation.How does it address the issue?
Add support for
no-use-container
allow the cli to passuse-container
= false in the samConfig fileWhat side effects does this change have?
no-use-container
can result touse_container = false
in samConfigsam sync
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make pr
passesmake update-reproducible-reqs
if dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.