Skip to content

Merge Request Approvals API #877

Closed
Closed

Description

@thuhc

Description of the problem, including code/CLI snippet

Since GitLab 12.3, gitlab changed API for MR approvals
https://docs.gitlab.com/ee/api/merge_request_approvals.html
project.approvals.get() --> cannot get list approvals
<class 'gitlab.v4.objects.ProjectApproval'> => {'approvers': [], 'approver_groups': [], 'approvals_before_merge': 2, 'reset_approvals_on_push': True, 'disable_overriding_approvers_per_merge_request': True, 'merge_requests_author_approval': False, 'merge_requests_disable_committers_approval': False}

Expected Behavior

  • Integration to this new API for MR approvals: get list approvals, add/remove approvals

Actual Behavior

  • Update API for MR approvals

Specifications

  • python-gitlab version: 1.11
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 12.3

Activity

  1. samvasko commented on Sep 9, 2019

    @samvasko

    The workaround right now is to call the attributes method. eg:
    mr.approvals.get().attributes

  2. max-wittig commented on Sep 9, 2019

    @max-wittig
    Member

    Hi @thuhc. Thanks for your issue report! This library is currently only maintained by me and I don't really focus on EE features. But if you want to fix this here, I would be happy to review your PR

  3. added
    EEIssues related to the enterprise version of GitLab
    on Sep 30, 2019
  4. tymonx commented on Nov 12, 2019

    @tymonx

    I have added two missing attributes: #934. It will not solve the missing approvals list but it fixes approvals configuration during the .save()

  5. JohnVillalovos commented on Jan 1, 2022

    @JohnVillalovos
    Member

    Closing this since as far as I know we have support for the Merge Request Approvals API:
    https://python-gitlab.readthedocs.io/en/main/gl_objects/merge_request_approvals.html

  6. JaxonWright commented on Jul 1, 2022

    @JaxonWright

    @JohnVillalovos that is not the same API. What is being asked for is the approvals API which shows stats on the current state of approvals for the MR. What you linked are the settings that determine what kind of approvals are required.

    EDIT: upon further analysis, I was wrong

  7. JohnVillalovos commented on Jul 1, 2022

    @JohnVillalovos
    Member

    @JohnVillalovos that is not the same API. What is being asked for is the approvals API which shows stats on the current state of approvals for the MR. What you linked are the settings that determine what kind of approvals are required.

    The issue description above said they wanted support for doing: project.approvals.get() and as far as I can tell PG supports that.

    If there is something else that is missing then an issue should be opened for that.

  8. nejch commented on Jul 1, 2022

    @nejch
    Member

    There's also an example for approval state in the docs linked, you can scroll down to mr.approval_state.get(). I admit I also personally don't have access to enterprise features though and so it's usually not a priority, not sure about @JohnVillalovos.

    So I'm unsure how well this works against a real server (not mocked unit tests), here we really rely on the community when implementing features :)

  9. JaxonWright commented on Jul 1, 2022

    @JaxonWright

    There's also an example for approval state in the docs linked, you can scroll down to mr.approval_state.get(). I admit I also personally don't have access to enterprise features though and so it's usually not a priority, not sure about @JohnVillalovos.

    So I'm unsure how well this works against a real server (not mocked unit tests), here we really rely on the community when implementing features :)

    Wow. I looked at this page like 5 times and didn't see that. That is what I'd been looking for!

  10. nejch commented on Jul 1, 2022

    @nejch
    Member

    @JaxonWright ah, feel free to split up that page a bit if you think it's not that clear, and open a PR here, we'll be more than happy to take a look! :)

  11. locked as resolved and limited conversation to collaborators on Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EEIssues related to the enterprise version of GitLabfeature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions