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: Enable discard-approval-on-plan for gitlab #5388

Merged
merged 9 commits into from
Mar 10, 2025

Conversation

moritz31
Copy link
Contributor

@moritz31 moritz31 commented Mar 6, 2025

what

This pull request enables discard-approval-on-plan for gitlab.

why

This enables a use case for me, which is already covered by atlantis but only for github.

tests

Adding a test with testcases in gitlab_client_test.go TestGithubClient_DiscardReviews.
Running the stack locally and testing from gitlab that the pull request approval is revoked.

references

Gitlab API Documentation https://docs.gitlab.com/api/merge_request_approvals/#reset-approvals-of-a-merge-request

@moritz31 moritz31 requested review from a team as code owners March 6, 2025 10:37
@moritz31 moritz31 requested review from chenrui333, lukemassa and nitrocode and removed request for a team March 6, 2025 10:37
@dosubot dosubot bot added feature New functionality/enhancement provider/gitlab labels Mar 6, 2025
@github-actions github-actions bot added the go Pull requests that update Go code label Mar 6, 2025
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.

Hi @moritz31, thanks for raising this PR.

Can you update the documentation at https://github.com/runatlantis/atlantis/blob/main/runatlantis.io/docs/server-configuration.md#--discard-approval-on-plan also detailing the GitLab token requirements.

Please also update the PR title and description to say that this change is enabling the discard-approval-on-plan feature for GitLab (The PR title is used for the Atlantis changelog entry)

@X-Guardian X-Guardian added the waiting-on-response Waiting for a response from the user label Mar 9, 2025
@moritz31 moritz31 changed the title feat: Add DiscardReviews for Gitlab feat: Enable discard-approval-on-plan for gitlab Mar 10, 2025
@moritz31 moritz31 requested a review from X-Guardian March 10, 2025 13:56
@moritz31 moritz31 requested a review from X-Guardian March 10, 2025 15:22
@moritz31
Copy link
Contributor Author

Hope this now fits, need to make some bigger adjustments because of no logger passed to that method.

@X-Guardian
Copy link
Contributor

Looking good @moritz31. The tests are failing if you could take a look.

@moritz31 moritz31 requested a review from X-Guardian March 10, 2025 18:00
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 for this @moritz31

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 10, 2025
@X-Guardian X-Guardian merged commit 7b40007 into runatlantis:main Mar 10, 2025
39 of 40 checks passed
@X-Guardian
Copy link
Contributor

Can you test that this is working correctly for you using one of these dev container images:

@moritz31
Copy link
Contributor Author

Thanks for your guidance! I have tested the alpine container in our live environment and it works like expected

inkel pushed a commit to inkel/atlantis that referenced this pull request Mar 18, 2025
CaioAugustoo pushed a commit to CaioAugustoo/atlantis that referenced this pull request Mar 27, 2025
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.

2 participants