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: add ignore-vcs-status-names (github only) #4978

Merged

Conversation

bakayolo
Copy link
Contributor

@bakayolo bakayolo commented Oct 4, 2024

what

Comma separated list of VCS status names from other atlantis services.

When gh-allow-mergeable-bypass-apply is true, will ignore status checks (e.g. status1/plan, status1/apply, status2/plan, status2/apply) from other atlantis services when checking if the PR is mergeable.

Only for Github but can be extended to other VCS in the future.

why

This PR is a proposal to close #2848

tests

I have only run make test but planning on testing in my own environment if the proposal is accepted.
Tested with make test and on my environment with bappr/atlantis:cud-ignore-vcs-status-names-ca1171e0dd174edbbd63f8f6ae560caa6af4c0c7-0.

references

closes #2848

`other-vcs-status-names-to-ignore` is a comma-separated list of atlantis vcs status names that will be ignored when deciding if the PR is mergeable or not.

This PR is a proposal to solve [runatlantis#2848](runatlantis#2848) for github client.
@bakayolo bakayolo requested review from a team as code owners October 4, 2024 03:07
@bakayolo bakayolo requested review from GenPage, lukemassa and nitrocode and removed request for a team October 4, 2024 03:07
@dosubot dosubot bot added the feature New functionality/enhancement label Oct 4, 2024
@jamengual
Copy link
Contributor

interesting proposition.
one quick thing I will say that instead of adding a flag for this it will be much better to add it to the server side repo config with something like :

vcs-status-to-ignore:
  - name1
  - name2
  - etc

@bakayolo
Copy link
Contributor Author

bakayolo commented Oct 4, 2024

@jamengual thanks for the feedback, why do you think it is much better? I would actually imagine that having other-vcs-status-names-to-ignore close to vcs-status-name would be less confusing no?

@jamengual
Copy link
Contributor

Because we have a trillion flags, and we want to avoid having more that is the main reason, plus if is moved there then you can have different repos regexes with different statuses.

@bakayolo
Copy link
Contributor Author

bakayolo commented Oct 4, 2024

@jamengual I've been looking at the code and I believe it's gonna be pretty complex to do

plus if is moved there then you can have different repos regexes with different statuses.

because the FetchPullStatus is not called at the repo config level. It's basically a sort of boolean ("has been approved" and "is mergeable", no conditions)

Also, I am struggling to understand the benefit of having different repos regexes with different statuses. Simply put, #2848 is basically a bug where multiple atlantis instances with different vcs status name conflict with each other and forbid the apply when mergeable is set. Which means that if we do not make atlantis aware of ALL the others atlantis running for the repo, they will continue conflicting with each others. So I think that config should be global.

Wdyt?

@jamengual
Copy link
Contributor

Sorry, this is a standard ask we ask everyone.
I did not look at the code to see if the context will be present at that point in the execution for you to do it.
As you mentioned, it could get pretty complex, so keeping the flag then is better.

@anryko
Copy link
Contributor

anryko commented Oct 4, 2024

Small nitpick, other in the name seems redundant. The vcs-status-names-to-ignore would be sufficient, but considering the pattern in other arguments naming (hide-, silence-, include-, allow-), the name should resemble ingnore-vsc-status-names.

@bakayolo
Copy link
Contributor Author

bakayolo commented Oct 4, 2024

FYI, I've tested this change on my environment (Dev, Staging, prod) with bappr/atlantis:cud-ignore-vcs-status-names-ca1171e0dd174edbbd63f8f6ae560caa6af4c0c7-0.

@jamengual jamengual added the waiting-on-review Waiting for a review from a maintainer label Oct 4, 2024
@bakayolo
Copy link
Contributor Author

Hey @jamengual, do you know when we can get this PR reviewed? It’s been running fine on 20 of my atlantis servers for the past 2 weeks and working as expected. I’d like to deploy it to my other 50 ones. But I would prefer to use your upstream version instead, versus my own docker image. Thanks.

@bakayolo
Copy link
Contributor Author

@X-Guardian thx, this is done.

@X-Guardian
Copy link
Contributor

The documentation needs updating to add this new flag here: https://github.com/runatlantis/atlantis/blob/main/runatlantis.io/docs/server-configuration.md

@github-actions github-actions bot added the docs Documentation label Oct 24, 2024
@bakayolo
Copy link
Contributor Author

@X-Guardian done as well. Thanks.

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

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

Nearly there @bakayolo. Just need to get the docs refined.

cmd/server.go Outdated Show resolved Hide resolved
runatlantis.io/docs/server-configuration.md Outdated Show resolved Hide resolved
@bakayolo bakayolo changed the title feat: add ignore-vcs-status-names feat: add ignore-vcs-status-names (github only) Nov 2, 2024
@bakayolo
Copy link
Contributor Author

bakayolo commented Nov 2, 2024

@X-Guardian thanks. Done.

Not sure this description is quite right. they might not be other Atlantis servers.

The description is actually right. This PR only ignore vcs status names such as something/plan and something/apply.

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

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

Thanks @bakayolo. Just a couple of small refinements and we are good to merge.

cmd/server.go Outdated Show resolved Hide resolved
runatlantis.io/docs/server-configuration.md Outdated Show resolved Hide resolved
bakayolo and others added 2 commits November 2, 2024 14:42
Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
Signed-off-by: bakayolo <benjamin.apprederisse@gmail.com>
Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
Signed-off-by: bakayolo <benjamin.apprederisse@gmail.com>
@bakayolo
Copy link
Contributor Author

bakayolo commented Nov 2, 2024

Thanks @X-Guardian ! Should be good! 👍

@X-Guardian
Copy link
Contributor

@bakayolo, can you resolve the merge conflicts?

Signed-off-by: bakayolo <benjamin.apprederisse@gmail.com>
@bakayolo
Copy link
Contributor Author

bakayolo commented Nov 4, 2024

@X-Guardian all good, thanks!

X-Guardian and others added 2 commits November 4, 2024 19:20
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 4, 2024
@X-Guardian X-Guardian merged commit 841f7b4 into runatlantis:main Nov 4, 2024
33 of 34 checks passed
@X-Guardian
Copy link
Contributor

Thanks for this @bakayolo. You can test it using one of these container images: dev-alpine-841f7b4 or dev-debian-841f7b4

@bakayolo bakayolo deleted the bakayolo/feat/vcs-status-names-ignore branch November 5, 2024 00:08
@bakayolo
Copy link
Contributor Author

bakayolo commented Nov 5, 2024

Nice! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation feature New functionality/enhancement go Pull requests that update Go code lgtm This PR has been approved by a maintainer provider/azuredevops provider/bitbucket provider/github provider/gitlab waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--gh-allow-mergeable-bypass-apply for multiple servers
4 participants