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

Option to ignore or skip a PR for autoplanning by github label/comment #632

Closed
max-rocket-internet opened this issue May 17, 2019 · 13 comments
Labels
feature New functionality/enhancement

Comments

@max-rocket-internet
Copy link

We have about 100 projects in a single repo, spread across about 10 different AWS accounts with about 30 different people making changes.

Naturally, different people have different work flows, and it's popular to create a PR and mark with "Work in Progress" with a WIP label, leave it open, add commits and then when ready remove the label and request review. In this scenario Atlantis will add plan comments for every commit which makes reading the PR very difficult both on Github and the email notifications (that include the full length comment).

It would be nice to be able to have Atlantis ignore or skip a PR based on labels or comments. For example, like Travis does with the [skip travis] commit message.

Does that sound reasonable? Or is it achievable in another way? I know we can just disable the autoplanner but then it's up to the user to manually choose the projects to plan, right?

@lkysow lkysow added the feature New functionality/enhancement label May 17, 2019
@lkysow
Copy link
Member

lkysow commented May 17, 2019

Fwiw you could achieve this with a custom workflow that makes a call back to GitHub to check the commits.

@max-rocket-internet
Copy link
Author

@lkysow thanks, that sounds like a great use case for custom workflow. I have a question though...

If our repo looks like this, with each directory being a "project":

/terraform/regions/usa
/terraform/regions/usa/environments/staging
/terraform/regions/usa/environments/production
...
/terraform/regions/eu
/terraform/regions/eu/environments/production
...
/terraform/teams/team1
/terraform/teams/team2
...
modules/module1
modules/module2

And maybe we write a script at /terraform/scripts/check-github-pr.sh, is there a way we could execute this script before terraform is run for all these locations without writing a custom workflow for each "project" directory?

@lkysow
Copy link
Member

lkysow commented May 20, 2019

@max-rocket-internet
Copy link
Author

Yep! But as I understand it, when we set the - run: option, the CWD is the directory of the project, right? So we would need to "find" the check-github-pr.sh script from CWD (of which there are many).

Is there any env var we could use to easily refer back to the root of the repository?

@lkysow
Copy link
Member

lkysow commented May 21, 2019

Ahh I see the issue. Not right now, although you could submit a PR to add a new variable called REPO_DIR that would use path and ctx.RepoRelDir to figure out the repo root.

@kipkoan
Copy link
Contributor

kipkoan commented May 21, 2019

You can use git rev-parse --show-toplevel

@max-rocket-internet
Copy link
Author

You can use git rev-parse --show-toplevel

Ah, very neat. Thanks.

Feel free to close this. Or leave it open as a feature idea/request. Up to you @lkysow

@chadasapp
Copy link

Maybe leveraging draft PRs is the way to go here? If it's a draft, a plan isn't gonna be as useful (and we shouldn't be applying from a draft, I'd think?)

@max-rocket-internet
Copy link
Author

we shouldn't be applying from a draft

Yep, sounds good

@lkysow
Copy link
Member

lkysow commented Jun 3, 2019

Atlantis doesn't understand draft PR's right now (#491).

I'd love a PR for Atlantis to ignore draft PRs. That would solve the first part of #491 and would help you with your issue Max. The downside is that when you moved the PR out of draft, you'd have to manually comment atlantis plan, but that's not too bad.

@raynigon
Copy link

This would be a pretty useful feature in combination with dependabot!
I think this could be implemented similiar to the RepoAllowListChecker.

@minamijoyo
Copy link
Contributor

Hi @raynigon and all, looks duplicated #932, which could be fixed in #1799. Please upvote them if you like.

@ghaiszaher
Copy link
Contributor

I raised a pull request to add such feature (implemented only for Github and Gitlab clients in this PR): #3649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement
Projects
None yet
Development

No branches or pull requests

8 participants