Hi there,
via the API, I want to restrict pushing for new repositories to specific groups and users. This works nicely for most cases - as described in the API documentation, I can restrict pushing, e.g., for user ABC and group XYZ using
{
"branch_match_kind": "glob", "pattern": "main",
"kind": "push",
"users": [ { "username": "ABC" } ],
"groups": [ { "slug": "XYZ" } ]
}
However, there is one user for whom this does not work - the administrative "Jenkins" user. For him, I get an error
"error": {"message": "write or admin access required: jenkins"}
I would have thought this means that "Jenkins" requires specific access to the repository, but even giving him admin permissions on the repository did not help. At the same time, I can allow pushing for "Jenkins" manually in the GUI (even without the admin permissions).
I am wondering if this has to do with my limited admin status in our company workspace - while I am an admin in the specific project where I want to import the repositories, I have few permissions beyond.
I am using an AppPassword that has Write+Admin access both for "Projects" and "Repositories" (and Read access for "Workspace membership").
Any ideas anyone?
Cheers
C.
Hi @Hansi B_ and welcome to the community!
This error shows when the user you are trying to add does not have at least write permissions to the repo. I believe you are using the wrong username. I checked the workspaces you have access to, and although there is a user with Name 'Jenkins' in one of them, the username of this account is different.
If you have access to this account's credentials, you can log in to https://bitbucket.org/ with that user's email and password and find the username here: https://bitbucket.org/account/settings/. If you don't, you can ask the person who set up this account to check.
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
Thank you, that was indeed the problem. An admin has provided me with the uuid of the "Jenkins" user, and using that works:
{
"branch_match_kind": "glob", "pattern": "main",
"kind": "push",
"users": [ { "uuid": "{abcdef-xyzxyzyxz-123etc}" } ]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's good to hear, thank you for the update. Please feel free to reach out if you ever need anything else!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.