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

feat: Disable policy check on some repositories #3503

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

AndreZiviani
Copy link
Contributor

@AndreZiviani AndreZiviani commented Jun 8, 2023

what

Allows the user to disable policy checking on some repositories

why

Policy checking is really usefull but sometimes we may want to disable it on some repositories, currently we would need a separate Atlantis instance for that

tests

Tested only some standard cases locally, will be running this change in our environment next week

references

@AndreZiviani AndreZiviani requested a review from a team as a code owner June 8, 2023 21:16
@github-actions github-actions bot added docs Documentation go Pull requests that update Go code labels Jun 8, 2023
@rkstrickland
Copy link
Contributor

@AndreZiviani - I was only able to take a quick look today. I'll try to give this a more thorough lookover tomorrow.

Can you add an e2e test?

@AndreZiviani
Copy link
Contributor Author

@rkstrickland I wasn't sure where to add the tests, let me know if there is somewhere better and if those are enough

@AndreZiviani AndreZiviani force-pushed the policy-check-per-repo branch from 484771f to 34a46b7 Compare June 9, 2023 15:19
@rkstrickland
Copy link
Contributor

@AndreZiviani - For e2e test, you'd want to add a cases here: https://github.com/runatlantis/atlantis/blob/main/server/controllers/events/events_controller_e2e_test.go#L816

Try to account for various conditions where policy check is enabled/disabled in opposing fashion between global and repo config.

@AndreZiviani
Copy link
Contributor Author

AndreZiviani commented Jun 9, 2023

@rkstrickland I had a hard time figuring out how to run them (was trying to run the scripts/e2e.sh) but figured out in the end, please check if this is what you have in mind

@AndreZiviani AndreZiviani requested a review from nitrocode June 13, 2023 19:59
@AndreZiviani
Copy link
Contributor Author

hey @rkstrickland just a friendly reminder to review this PR :)

```

## Running policy check only on some repositories
Copy link
Contributor

Choose a reason for hiding this comment

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

If i understand the changes correctly, the configuration could be denied explicitly globally and enabled on desired repos too, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct, in order to not break backwards compatibility you have to enable it globally (via --enable-policy-checks) and exclude the repositories that you want

@pseudomorph
Copy link
Contributor

This change seems to make sense and appears to have good test coverage.

@AndreZiviani AndreZiviani force-pushed the policy-check-per-repo branch from d155e29 to 61024ac Compare June 28, 2023 18:07
@lknhd
Copy link

lknhd commented Jul 4, 2023

i've been using this feature on my production for couple weeks now. seems good.
Hope this gets merge soon. thanks @AndreZiviani.

@AndreZiviani AndreZiviani requested a review from pseudomorph July 4, 2023 13:28
@GenPage GenPage merged commit 974eed3 into runatlantis:main Jul 6, 2023
@GenPage
Copy link
Member

GenPage commented Jul 6, 2023

Thank you for the contribution

AndreZiviani added a commit to AndreZiviani/atlantis that referenced this pull request Jul 6, 2023
AndreZiviani added a commit to AndreZiviani/atlantis that referenced this pull request Jul 6, 2023
jamengual pushed a commit that referenced this pull request Jul 6, 2023
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
* feat: Allow enabling policy check per repository

* chore: Tests

* chore: Docs

* chore: Improve tests

* chore: E2E tests
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
* feat: Allow enabling policy check per repository

* chore: Tests

* chore: Docs

* chore: Improve tests

* chore: E2E tests
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conftest checks all repositories even when specified for a single repo
6 participants