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

Cannot update/patch protected branch allowed_to_push/push_access_levels state #2850

Open
nickbroon opened this issue May 1, 2024 · 1 comment

Comments

@nickbroon
Copy link
Contributor

Description of the problem, including code/CLI snippet

Breaking out discussion from this Pull Request thread into its own issue.

The Save and Update mixins for protectedbranch doesn't really work for most of it's attributes, as the PATCH/POST api use different values from those return by the API.

The PATCH api requires to send allowed_to_push attribute, but the returned attribute is push_access_levels, as documented in the API and examples: https://docs.gitlab.com/ee/api/protected_branches.html#example-update-a-push_access_level-record

Expected Behavior

To be able to update to update either `allowed_to_push' GitLab protected branch state.

Actual Behavior

Using the python-gitlab library to modify the push_access_levels attribute that the object has and then calling .save() appears to do nothing, and the python object has no allowed_to_push attribute to modify.

It does work for the basic .allow_force_push protectedbranch attribute, as added and tested in the original Pull Request.

Specifications

  • python-gitlab version: unreleased (a867c48)
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): gitlab.com
@JohnVillalovos
Copy link
Member

I think historically we have left issues like this up to the user to handle. As I think the idea of python-gitlab is to be a thin wrapper over the GitLab API. The positive to doing this is it makes things easier for the users. The negative is that it adds more work for the volunteer developers of python-gitlab to add this and there are other inconsistencies in the upstream API that would thus wanted to be added. And then the maintenance of this if GitLab changes the API.

This might be a good thing to raise upstream and ask GitLab to resolve this inconsistency.

Interested to get @nejch opinion about this.

@nickbroon Off topic, I was in Edinburgh just two days ago 😄 But now back in the Portland, Oregon area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants