Skip to content
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

Parse atmos.yaml CLI config when executing atmos vendor command. Improve OPA policy evaluation and error handling #222

Merged
merged 6 commits into from
Oct 20, 2022

Conversation

aknysh
Copy link
Member

@aknysh aknysh commented Oct 20, 2022

what

  • Parse atmos.yaml CLI config when executing atmos vendor command
  • Improve OPA policy evaluation and error handling

why

  • When executing atmos vendor pull command, we need to parse atmos.yaml and calculate the paths to stacks and components folders to write the vendored files into the correct component folder
  • Add timeout to OPA policy evaluation (it will show a descriptive error message instead of hanging forever if Rego policy is not correctly defined/formatted or Regex in Rego is not correct)
  • Output error in the case when using Regex in Rego policy and the Regex contains a non-escaped backslash
If a regex pattern in the `re_match` function contains a backslash to escape special chars (e.g. `\.` or `\-`),
it must be escaped with another backslash when represented as a regular Go string (`\\.`, `\\-`).
The reason is that backslash is also used to escape special characters in Go strings like newline (\n).
If you want to match the backslash character itself, you'll need four slashes.

@aknysh aknysh added the patch A minor, backward compatible change label Oct 20, 2022
@aknysh aknysh requested review from a team as code owners October 20, 2022 07:11
@aknysh aknysh self-assigned this Oct 20, 2022
@aknysh aknysh requested review from Gowiem and woz5999 October 20, 2022 07:11
@aknysh aknysh changed the title Parse atmos.yaml CLI config for atmos vendor command. Improve OPA policy evaluation and error handling Parse atmos.yaml CLI config when executing atmos vendor command. Improve OPA policy evaluation and error handling Oct 20, 2022
Copy link
Member

@nitrocode nitrocode left a comment

Choose a reason for hiding this comment

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

If v3.1.0 is not an issue, then this lgtm

@aknysh aknysh merged commit d09cbdc into master Oct 20, 2022
@aknysh aknysh deleted the update-cli-config-for-vendoring branch October 20, 2022 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch A minor, backward compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants