Bitbucket credentials not properly fetched after upgrade

i’m running Drone server on version 1.9.1 and it is working like a charm.

I’ve tried to update our setup to 1.10.1 and 2.0.1 and when i upgrade the server and the users are sync again from bitbucket server write permissions are not fetched properly from bitbucket causing users with write permissions not able to restart builds, configure secrets etc.

IE:
while running 1.9.1 if i check the api for a test user i created, i can see for both projects that the user has write permissions.


once upgraded the same user after sync repositories looses the permissions.


any idea on what have changed from version 1.9.1??? i can not upgrade our drone instance.

Hi guys, i know you have moved this to support but i do think this is a bug.

i’ve been doing some testing and i’ve found the issue and it might be related to Bitbucket Server (Stash) Write Access · Issue #15 · drone/go-scm · GitHub.

After digging into the code of go-scm library i’ve found that you changed the request to fetch the repositories with write permissions while calculating the permissions.

But this query, at least in our bitbucket server 7.6.0, it does not work.
ie: /rest/api/1.0/repos?size=1000&permission=REPO_WRITE&name=flux-releases&projectname=CP

{"size":0,"limit":25,"isLastPage":true,"values":[],"start":0}

But if I run the previous request /rest/api/1.0/repos?size=1000&permission=REPO_WRITE&name=flux-releases&project=CP then i get a nice

{"size":1,"limit":25,"isLastPage":true,"values":[{"slug":"flux-releases","id":901,"name":"flux-releases","hierarchyId":"b92d25b5e263aefe386d","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"CP","id":289,"name":"Container Platform","description":"This project is used to build the container platform infrastructure","public":false,"type":"NORMAL","links":{"self":[{"href":"https://bitbucket.voiceworks.com/projects/CP"}]}},"public":false,"links":{"clone":[{"href":"https://bitbucket.voiceworks.com/scm/cp/flux-releases.git","name":"http"},{"href":"ssh://[email protected]/cp/flux-releases.git","name":"ssh"}],"self":[{"href":"https://bitbucket.voiceworks.com/projects/CP/repos/flux-releases/browse"}]}}],"start":0}

Could you please verify it? this is preventing us to upgrade drone from 1.9.1 where it was working fine

let me know if you want me to create a PR

Tested with drone 2.0.1 and confirmed this fix the issue.