-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Upgrade conftest version to 0.23 #1516
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
93ce558
Upgraded conftest to 0.23.0 and removed --all-namespaces flag (#62)
msarvar 20296f9
Update e2e tests to use 0.23 conftest
msarvar 945dad8
Fix log function
msarvar e81a287
Make test client fetch version synchronously.
641718e
Merge branch 'upgrade_conftest_version' of github.com:lyft/atlantis i…
4ef7ed9
Update fixtures.
b0f2617
Merge branch 'master' of github.com:runatlantis/atlantis into upgrade…
msarvar 75edc82
Pinning test image
msarvar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM runatlantis/atlantis:latest | ||
COPY atlantis /usr/local/bin/atlantis | ||
# TODO: remove this once we get this in the base image | ||
ENV DEFAULT_CONFTEST_VERSION=0.21.0 | ||
ENV DEFAULT_CONFTEST_VERSION=0.23.0 | ||
|
||
WORKDIR /atlantis/src |
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you help me understand why
--all-namespaces
was dropped? We where anticipating this being presentThere 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.
Why was this pulled into 0.17.0 4 days before the release to stable, with this major of a behavior regression? This straight up breaks anyone organizing their policies into multiple namespaces, with no ability to organize as they please. In addition, this is not necessary for the PR's listed goal of upgrading conftest - nor is it explained at all in the PR.
This should be reverted, and @msarvar can add a config flag to atlantis to toggle that if lyft wants to disable --all-namespaces.
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.
Sorry about the regression since it was a pre-prod release we took some liberties with backwards incompatible changes in the general release
I'll let @msarvar answer to specifics as to why it was removed and whether we should add it back.
As for a current workaround, you can still have folder separation, your rules just have to all be declared in the same package.
Why this works for us is because you can have namespaces within your folders that you decide should get pulled into the main package. This makes things like testing easier.
e.g.
/policies/set1/main.rego
/policies/set1/infra.rego
/policies/set1/infra_test.rego
Based on this example, we wouldn't want to load all namespaces. Also doesn't seem like there is a way to have this nice co-existence of tests and rules if we did want to load all namespaces by default.
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.
As a counterpoint - the tests could be written with that level of separation, without putting the onus on the end users to manually update the list of policies every time they add a new policy to be checked. :)
I do believe designing for simplified unit tests at the expense of end-user experience is an anti-pattern. There are several ways to approach this in a more user-friendly manner:
Additionally, right now, the config only allows for 'local' policies. However, a fairly reasonable extension of that would be to load policies via pointing to a git repo that would be fetch'd before updating. The current behavior would require that repo full of policies MUST have unique function names everywhere and can only use the main namespace. If the end user wishes to lift this restriction, then they must maintain a fork of atlantis.
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.
Sorry about reverting the code as @nishkrishnan mentioned it was a pre-release and we took some liberties to make changes. The reason behind the revert was that conftest was not working properly when using a helper library. For instance regula would fail with
--all-namespaces
flag. To demonstrate the issue try runningYou will receive an error similar to:
Removing the
--all-namespaces
flag just makes it easier to use libraries like regula in your policies. And you're still free to namespace you policies as described in the previous comment.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.
@rgooler in the current behavior you are required to have unique functions within the namespaces. You are able to share those namespaces across all of your polices, no? The only thing your main package needs to do is to run
deny
query. Or am I missing something?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 this is to stay, then the most obvious need is that the documentation get updated so that its clear the package needs to be main. As it currently stands, there is no messaging about namespaces, and the example is implying that you can have whatever namespace you want. https://github.com/runatlantis/atlantis/blame/master/runatlantis.io/docs/policy-checking.md#L58