-
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
fix(gitlab): Add backwards compatible mergability check #3277
fix(gitlab): Add backwards compatible mergability check #3277
Conversation
@@ -408,8 +429,8 @@ func TestGitlabClient_MarkdownPullLink(t *testing.T) { | |||
Equals(t, exp, s) | |||
} | |||
|
|||
var mergeSuccess = `{"id":22461274,"iid":13,"project_id":4580910,"title":"Update main.tf","description":"","state":"merged","created_at":"2019-01-15T18:27:29.375Z","updated_at":"2019-01-25T17:28:01.437Z","merged_by":{"id":1755902,"name":"Luke Kysow","username":"lkysow","state":"active","avatar_url":"https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80\u0026d=identicon","web_url":"https://gitlab.com/lkysow"},"merged_at":"2019-01-25T17:28:01.459Z","closed_by":null,"closed_at":null,"target_branch":"patch-1","source_branch":"patch-1-merger","upvotes":0,"downvotes":0,"author":{"id":1755902,"name":"Luke Kysow","username":"lkysow","state":"active","avatar_url":"https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80\u0026d=identicon","web_url":"https://gitlab.com/lkysow"},"assignee":null,"source_project_id":4580910,"target_project_id":4580910,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_pipeline_succeeds":false,"detailed_merge_status":"mergeable","sha":"cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0","merge_commit_sha":"c9b336f1c71d3e64810b8cfa2abcfab232d6bff6","user_notes_count":0,"discussion_locked":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"web_url":"https://gitlab.com/lkysow/atlantis-example/merge_requests/13","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"squash":false,"subscribed":true,"changes_count":"1","latest_build_started_at":null,"latest_build_finished_at":null,"first_deployed_to_production_at":null,"pipeline":null,"diff_refs":{"base_sha":"67cb91d3f6198189f433c045154a885784ba6977","head_sha":"cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0","start_sha":"67cb91d3f6198189f433c045154a885784ba6977"},"merge_error":null,"approvals_before_merge":null}` |
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.
What I've done here is add "merge_status":"can_be_merged"
to the testdata response. If preferred I can add a fully separate dataset instead.
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.
I will say maybe add a fully separated dataset instead
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.
Oh missed this comment. Agreed. It would be better to just put it in a separate pretty formatted json file. We do separate supporting test files for terraform tests so json wouldn't be any different
@jukie do you mind pairing with someone in issue #3258 like @zerog2k and having them verify that this change will work as expected for older versions since you do not have a version to test with? If you take your feature branch and merge it with your HEAD branch of your fork, new atlantis container will be built and pushed to your fork. This new image can then be used by anyone to verify the change in this pr works as expected. |
@zerog2k if you could check with either of the following images:
|
cc @skruger ^ |
Also from #3089 cc @rhysm @mustdiechik |
Thanks @jukie appears to be working for me on gitlab ee 14.10.5 and your build |
@nitrocode looks like we're good here then? I'll get the test case updated though. |
I tried the dev image, I am still facing the same issue #3270 |
@d-cryptic the only API change between these versions was detailed merge status vs merge status so functionality for approvals should be the same. |
I did, but it's not working !! |
@d-cryptic i know this is frustrating for you. Please remember that we're all doing this as volunteer work so please try to keep your messages as helpful as possible to reduce the back and forth. For a developer to fix this, can you post error logs and anything that may be helpful in #3270 (the issue you first created)? I have reopened the ticket. |
Check my note in #3270 (comment) @d-cryptic is running gitlab community edition so requiring approvals before merge isn't an option. |
maybe we should add that to the docs
…On Sat, Apr 1, 2023, 8:47 a.m. Isaac Wilson ***@***.***> wrote:
Check my note in #3270 (comment)
<#3270 (comment)>
@d-cryptic <https://github.com/d-cryptic> is running gitlab community
edition so requiring approvals before merge isn't an option.
—
Reply to this email directly, view it on GitHub
<#3277 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERDBQBB2G43277QTL5DW7BEXVANCNFSM6AAAAAAWMKZ6VY>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
I can add a note within the Gitlab section of https://www.runatlantis.io/docs/command-requirements.html#approved Also wondering the best place in code is to add a check via https://docs.gitlab.com/ee/api/metadata.html for the value of |
I'll open another WIP PR and we'll discuss there |
sounds good
…On Sat, Apr 1, 2023, 12:02 p.m. Isaac Wilson ***@***.***> wrote:
I'll open another WIP PR and we'll discuss there
—
Reply to this email directly, view it on GitHub
<#3277 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERCWXC2V2ZGY5O3C5ITW7B3VXANCNFSM6AAAAAAWMKZ6VY>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
So in community edition, |
Correct @d-cryptic. Looks like there was already a notice in the docs as well so I'm not sure we need any updates there -
|
* Add backwards compatibility for merability check in Gitlab client * Cleanup
…3277) * Add backwards compatibility for merability check in Gitlab client * Cleanup
…3277) * Add backwards compatibility for merability check in Gitlab client * Cleanup
what
Adds a conditional for whether the gitlab client version supports
detailed_merge_status
(anything 15.6+) and will use the oldmerge_status
if it doesn't.why
In newer versions of Atlantis, apply requirements won't work if users are running older versions of gitlab.
tests
I don't have a gitlab server <15.6 to test with but I've reviewed the api response data and updated tests accordingly
references