Skip to content

feat: configuration file for sam cli commands - #1502

Merged
sriram-mv merged 9 commits into
aws:release-v0.32.0from
sriram-mv:config_file
Nov 15, 2019
Merged

sriram-mv merged 9 commits into
aws:release-v0.32.0from
sriram-mv:config_file

Conversation

@sriram-mv

@sriram-mv sriram-mv commented Nov 5, 2019 •

Copy link
Copy Markdown
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sriram-mv
sriram-mv force-pushed the config_file branch 2 times, most recently from 25307ea to 5cca4c3 Compare November 5, 2019 06:53
@sriram-mv

Copy link
Copy Markdown
Contributor Author

Integration tests are working locally, need to investigate appveyor gates. Unrelated PR: #1501 is experiencing similar issues.

@sriram-mv
sriram-mv force-pushed the config_file branch 2 times, most recently from 61b79d6 to 417b857 Compare November 10, 2019 20:35
@sriram-mv

Copy link
Copy Markdown
Contributor Author

open to modification of --identifier. it could be environment, mode, config.

@awood45 awood45 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is well-formed, assuming the design stays in line. Before shipping, I'd want to see functional or integration tests which integrate config file fixtures against real commands.

@sriram-mv

Copy link
Copy Markdown
Contributor Author

@awood45 thanks for the review! yes those tests will be added in next series of commits.

@sanathkr sanathkr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, add the config file option to generate-event command as well

Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this will be changed to samconfig.toml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed.

Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • What happens if the file does not exist?
  • What happens if the TOML file cannot be parsed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are checks for that.

Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we print a error message to customers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to error, although might be polluting if they choose not to use a config file.

Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick line explaining what the method does?

Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this param a string or pathlib?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a string. understandable by os.path, can change to pathlib

Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is default added to param?

Comment thread samcli/cli/cli_config_file.py Resolved
Comment thread samcli/cli/cli_config_file.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this os.path.abspath again here is dangerous. It is a good practice to do relative->absolute path conversion once because it's tricky getting the right cwd

Comment thread samcli/cli/cli_config_file.py Resolved
- add passthroughs to the CLI command line interface via a configuration
  file
- local defaults are set at: `.aws-sam/samconfig.toml`
- This commit contains code copied and modified from https://github.com/phha/click_config_file/blob/master/click_config_file.py under MIT license
- descope environment variables
- move samconfig.toml back to project root
@sriram-mv
sriram-mv changed the base branch from develop to release-v0.32.0 November 14, 2019 07:55
Comment thread requirements/base.txt Resolved
Comment thread samcli/cli/cli_config_file.py Resolved
Comment thread samcli/cli/cli_config_file.py Resolved
Comment thread samcli/commands/_utils/options.py Resolved

@sanathkr sanathkr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sriram-mv
sriram-mv merged commit b2f4cf2 into aws:release-v0.32.0 Nov 15, 2019
sriram-mv added a commit that referenced this pull request Nov 20, 2019
* feat: configuration file for sam cli commands

- add passthroughs to the CLI command line interface via a configuration
  file
- local defaults are set at: `.aws-sam/samconfig.toml`
- This commit contains code copied and modified from https://github.com/phha/click_config_file/blob/master/click_config_file.py under MIT license

* fix: add identifier name argument instead of configuration files.

* rework: change command key construction logic

- descope environment variables
- move samconfig.toml back to project root

* docstring: TomlProvider class

* fix: allow spaces on certain deploy options

* fix: REGEX for parameter overrides

* fix: infer config path name from ctx

* fix: set abs path to `ctx.config_path`

* fix: set dirname for config_path not template file name.
sriram-mv added a commit that referenced this pull request Nov 23, 2019
* feat: configuration file for sam cli commands

- add passthroughs to the CLI command line interface via a configuration
  file
- local defaults are set at: `.aws-sam/samconfig.toml`
- This commit contains code copied and modified from https://github.com/phha/click_config_file/blob/master/click_config_file.py under MIT license

* fix: add identifier name argument instead of configuration files.

* rework: change command key construction logic

- descope environment variables
- move samconfig.toml back to project root

* docstring: TomlProvider class

* fix: allow spaces on certain deploy options

* fix: REGEX for parameter overrides

* fix: infer config path name from ctx

* fix: set abs path to `ctx.config_path`

* fix: set dirname for config_path not template file name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants