Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45836

Repositories you contribute to but don't own won't appear in Branch Source Plugin

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      A Bitbucket repository which is owned by an individual account can't be used with Jenkins as the Branch Source Plugin Currently functions.

      Currently, when loading the repositories after entering the Owner name, It makes a request to the BB API essentially "Give me all projects the credentialed user is a teammember on, or all repos owned by the crednetialed user, which are also owned by the username above".

      This causes a gap in the repo you're attempting to build is not a part of a project that your jenkins account is a team-member on, but instead is just a contributor for on someone else's repo. 

      In Version 2.1.x  the repository name was just a text field, allowing you to enter owner and repo manually and it worked fine. My Jenkins is now stuck at that version (and the related old versions of other plugins) because it can't properly select our repo anymore.

       

        Attachments

          Issue Links

            Activity

            Hide
            ironsean Sean MacKay added a comment -

            Still ongoing with BitBucket Branch Source 2.2.3. I might need to manually roll back to a 2.1.x version to verify that's where it was introduced. The bug might be in how the credentials are passed to Bitbucket in the request for repositories.

            Show
            ironsean Sean MacKay added a comment - Still ongoing with BitBucket Branch Source 2.2.3. I might need to manually roll back to a 2.1.x version to verify that's where it was introduced. The bug might be in how the credentials are passed to Bitbucket in the request for repositories.
            Hide
            ironsean Sean MacKay added a comment -

            The issue seems to be that it's either not using the username:password credential properly, or it's sending ?role=owner which only returns repositories you are the owner of.

            Removing the role=owner and passing the credentials I can properly curl the repositories response. I went to make the fix myself but don't immediately see where the change could be made.

            Show
            ironsean Sean MacKay added a comment - The issue seems to be that it's either not using the username:password credential properly, or it's sending ?role=owner which only returns repositories you are the owner of. Removing the role=owner and passing the credentials I can properly curl the repositories response. I went to make the fix myself but don't immediately see where the change could be made.
            Hide
            ironsean Sean MacKay added a comment -

            This can be worked around by reverting to 2.1.2 where the Repository name is a text field rather than a select dropdown, and manually entering the repo name. I've done that now since Jenkins builds have been non-functional for the two weeks since this happened.

            Show
            ironsean Sean MacKay added a comment - This can be worked around by reverting to 2.1.2 where the Repository name is a text field rather than a select dropdown, and manually entering the repo name. I've done that now since Jenkins builds have been non-functional for the two weeks since this happened.
            Hide
            ironsean Sean MacKay added a comment -

            The new Blue Ocean v1.2.0 now requires the latest Bitbucket Branch Source Plugin, and still breaks all builds because it can't be configured properly. reverting the Blue Ocean update is looking like a pain.. might need to look into other CI options at this point...

            Show
            ironsean Sean MacKay added a comment - The new Blue Ocean v1.2.0 now requires the latest Bitbucket Branch Source Plugin, and still breaks all builds because it can't be configured properly. reverting the Blue Ocean update is looking like a pain.. might need to look into other CI options at this point...
            Hide
            abayer Andrew Bayer added a comment -

            Jesse Glick - could this be related to JENKINS-45806?

            Show
            abayer Andrew Bayer added a comment - Jesse Glick - could this be related to JENKINS-45806 ?
            Hide
            abayer Andrew Bayer added a comment -

            And Sean MacKay - is this a mercurial repo or a git repo?

            Show
            abayer Andrew Bayer added a comment - And Sean MacKay - is this a mercurial repo or a git repo?
            Hide
            jglick Jesse Glick added a comment -

            Andrew Bayer certainly not a duplicate, since that involves retrieve, whereas this is some doFillXXX method.

            Show
            jglick Jesse Glick added a comment - Andrew Bayer certainly not a duplicate, since that involves retrieve , whereas this is some doFillXXX method.
            Hide
            ironsean Sean MacKay added a comment -

            Andrew, it's a git repo. If you set the owner name to an invalid one (or the credentials to an incorrect set, I forget which) you can get the api URL it's erroring out on, which includes "role=owner" and therefore only returns repositories that are owned by the account Jenkins authenticated with.

            Show
            ironsean Sean MacKay added a comment - Andrew, it's a git repo. If you set the owner name to an invalid one (or the credentials to an incorrect set, I forget which) you can get the api URL it's erroring out on, which includes "role=owner" and therefore only returns repositories that are owned by the account Jenkins authenticated with.
            Hide
            ironsean Sean MacKay added a comment -

            I confirmed as well, if I create a repo owned by my account I can see it. And if it's a repo on a team I'm an administrator  or member on on I can see it. But if it's a repo owned by another account that you have Read and Write permissions for, but don't own, administrate, or belong to a team for then you can't see it.

            Though this I do see a potential workaround for myself now, which is get a proper Bitbucket team set up for that repo.

            Show
            ironsean Sean MacKay added a comment - I confirmed as well, if I create a repo owned by my account I can see it. And if it's a repo on a team I'm an administrator  or member on on I can see it. But if it's a repo owned by another account that you have Read and Write permissions for, but don't own, administrate, or belong to a team for then you can't see it. Though this I do see a potential workaround for myself now, which is get a proper Bitbucket team set up for that repo.
            Hide
            abayer Andrew Bayer added a comment -

            Ok, so I have literally no background with Bitbucket or this plugin, but I'll see what I can do until someone who actually knows it comes along. =)

            It looks like relevant code is here - I guess we're saying "If you're in a team, we don't specify a UserRoleInRepository, but if you aren't in a team, we assume you're an owner". I'm guessing we should instead be defaulting to CONTRIBUTOR? I'm not sure if there's some issue with that down the line - i.e., you can't set up webhooks for a repo if you just have read/write...

            Show
            abayer Andrew Bayer added a comment - Ok, so I have literally no background with Bitbucket or this plugin, but I'll see what I can do until someone who actually knows it comes along. =) It looks like relevant code is here - I guess we're saying "If you're in a team, we don't specify a UserRoleInRepository , but if you aren't in a team, we assume you're an owner". I'm guessing we should instead be defaulting to CONTRIBUTOR ? I'm not sure if there's some issue with that down the line - i.e., you can't set up webhooks for a repo if you just have read/write...
            Hide
            ironsean Sean MacKay added a comment -

            I created the following Pull Request with that suggestion:

            https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/71

            Is there a way I can build and test it locally? The `Messages` Symbol currently can't resolve, so I can't even build it. But if I solve that can I build it as a plugin then manually upload to Jenkins to verity it works?

            Show
            ironsean Sean MacKay added a comment - I created the following Pull Request with that suggestion: https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/71 Is there a way I can build and test it locally? The `Messages` Symbol currently can't resolve, so I can't even build it. But if I solve that can I build it as a plugin then manually upload to Jenkins to verity it works?
            Hide
            ironsean Sean MacKay added a comment -

            Updated the ticket title and description. The newest release 2.2.5 also does nothing to address this. My PR is still available I believe, and I'm still using 2.1.2 in order to keep Jenkins functional.

            Show
            ironsean Sean MacKay added a comment - Updated the ticket title and description. The newest release 2.2.5 also does nothing to address this. My PR is still available I believe, and I'm still using 2.1.2 in order to keep Jenkins functional.
            Hide
            stephenconnolly Stephen Connolly added a comment -

            2.2.8

            Show
            stephenconnolly Stephen Connolly added a comment - 2.2.8

              People

              • Assignee:
                Unassigned
                Reporter:
                ironsean Sean MacKay
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: