FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge Request Update POST returns 200 with no change · Issue #2613 · python-gitlab/python-gitlab · GitHub

Repository navigation

Merge Request Update POST returns 200 with no change #2613

Description

Description of the problem, including code/CLI snippet

I'm using the code snippet here to update reviewers on a merge request, but the "Reviewers" field isn't updating despite gitlab returning "200 OK" after the POST request is sent.

Expected Behavior

A valid POST request with the reviewer_ids field set to an integer array updates the reviewers on the merge request. E.g.

mr.reviewer_ids = [1001, 1002, 1003]
mr.save()

should return

{'id': ...
 'reviewers': [{'id': 1001, 'username': ...}, {'id': 1002, 'username': ...}, {'id': 1003, 'username': ...}],
...
}

Actual Behavior

Turning on http debugging for the above python, I can see the POST request get sent and the gitlab server responds with a 200 OK:

send: b'PUT /api/v4/projects/31242/merge_requests/18 HTTP/1.1\r\nHost: REDACTED\r\nUser-Agent: python-gitlab/3.15.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nPRIVATE-TOKEN: REDACTED\r\nContent-type: application/json\r\nContent-Length: 36\r\n\r\n'
send: b'{"reviewer_ids": [1001, 1002, 1003]}'
reply: 'HTTP/1.1 200 OK\r\n'

And dumping the updated fields returned shows no reviewers:

{'id': ...
 'reviewers': [],
...
}

Specifications

  • python-gitlab version: 3.15.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): GitLab Enterprise Edition 15.7.5-ee

Activity

  1. JohnVillalovos commented on Jul 14, 2023

    Member

    Have you tried doing a fresh get() to download the data from the server?

  2. cmilhaupt commented on Jul 14, 2023

    Author

    Adding the following code snippet after mr.save():

    mr.reviewer_ids =[1001, 1002, 1003]
    mr.save()
    # new code here
    res = mr.manager.get(mr.iid)
    print("res:", res)
    

    Results in only the first id being assigned as a reviewer:

    'reviewers': [{'id': 1001, 'username': 'XXXXX', ...}]
    

    That change is also reflected in the web interface, where no reviewers could be seen using the code in the original description.

    Am I using the reviewer_ids field correctly? The type in the docs is listed as an integer array.

  3. JohnVillalovos commented on Jul 14, 2023

    Member

    Might be related to: #1735

  4. JohnVillalovos commented on Jul 14, 2023

    Member

    @cmilhaupt

    Not sure if you want to try this change out:

    diff --git a/gitlab/v4/objects/merge_requests.py b/gitlab/v4/objects/merge_requests.py
    index d4c39332..f47ef6f0 100644
    --- a/gitlab/v4/objects/merge_requests.py
    +++ b/gitlab/v4/objects/merge_requests.py
    @@ -478,6 +478,7 @@ class ProjectMergeRequestManager(CRUDMixin, RESTManager):
             "approved_by_ids": types.ArrayAttribute,
             "iids": types.ArrayAttribute,
             "labels": types.CommaSeparatedListAttribute,
    +        "reviewer_ids": types.ArrayAttribute,
         }
    
         def get(
    
  5. cmilhaupt commented on Jul 14, 2023

    Author

    Bah I was adding users who didn't have permissions in the repo I was modifying with my script. Adding them fixed my issue. Sorry for the hassle and thanks for the help!

  6. JohnVillalovos commented on Jul 14, 2023

    Member

    Glad you figured it out!

  7. locked as resolved and limited conversation to collaborators on Jul 15, 2024
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL