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

SCMSource is [BitbucketSCMSource] which is not supported

      Hi,

      I have Bitbucket Team/Project with default configuration

      I already configured the webhook by using the guide here:  https://plugins.jenkins.io/bitbucket/
       
      But when I'm pusing code changes I can see that the jenkins got the webhook

      2021-03-07 17:37:47.044+0000 [id=258] INFO c.c.j.p.BitbucketPayloadProcessor#processWebhookPayload: Received commit hook notification for {"scm":"git","website":null,"uuid":"{c647e2e1-15a6-4d01-891c-b1b43282cae8}","links":{"self":{"href":"https://api.bitbucket.org/2.0/repositories/myorg/myservice"},"html":{"href":"https://bitbucket.org/myorg/myservice"},"avatar":{"href":"https://bytebucket.org/ravatar/%7Bc647e2e1-15a6-4d01-891c-b1b43282cae8%7D?ts=default"}},"project":{"links":{"self":{"href":"https://api.bitbucket.org/2.0/workspaces/myorg/projects/CP"},"html":{"href":"https://bitbucket.org/myorg/workspace/projects/CP"},"avatar":{"href":"https://bitbucket.org/account/user/myorg/projects/CP/avatar/32?ts=1614678995"}},"type":"project","name":"myorg Platform","key":"CP","uuid":"{09d0cc61-f823-47ec-b0e8-2edabb72cc63}"},"full_name":"myorg/myservice","owner":{"username":"myorg","display_name":"myorg","type":"team","uuid":"{664512eb-246b-41e4-9fb3-de8e2003c064}","links":{"self":{"href":"https://api.bitbucket.org/2.0/teams/%7B664512eb-246b-41e4-9fb3-de8e2003c064%7D"},"html":{"href":"https://bitbucket.org/%7B664512eb-246b-41e4-9fb3-de8e2003c064%7D/"},"avatar":{"href":"https://bitbucket.org/account/myorg/avatar/"}}},"workspace":{"slug":"myorg","type":"workspace","name":"myorg","links":{"self":{"href":"https://api.bitbucket.org/2.0/workspaces/myorg"},"html":{"href":"https://bitbucket.org/myorg/"},"avatar":{"href":"https://bitbucket.org/workspaces/myorg/avatar/?ts=1614788230"}},"uuid":"{664512eb-246b-41e4-9fb3-de8e2003c064}"},"type":"repository","is_private":true,"name":"myservice"}2021-03-07 17:37:47.044+0000 [id=258] INFO c.c.j.p.BitbucketPayloadProcessor#processWebhookPayload: Received commit hook notification for {"scm":"git","website":null,"uuid":"{c647e2e1-15a6-4d01-891c-b1b43282cae8}","links":{"self":{"href":"https://api.bitbucket.org/2.0/repositories/myorg/myservice"},"html":{"href":"https://bitbucket.org/myorg/myservice"},"avatar":{"href":"https://bytebucket.org/ravatar/%7Bc647e2e1-15a6-4d01-891c-b1b43282cae8%7D?ts=default"}},"project":{"links":{"self":{"href":"https://api.bitbucket.org/2.0/workspaces/myorg/projects/CP"},"html":{"href":"https://bitbucket.org/myorg/workspace/projects/CP"},"avatar":{"href":"https://bitbucket.org/account/user/myorg/projects/CP/avatar/32?ts=1614678995"}},"type":"project","name":"myorg Platform","key":"CP","uuid":"{09d0cc61-f823-47ec-b0e8-2edabb72cc63}"},"full_name":"myorg/myservice","owner":{"username":"myorg","display_name":"myorg","type":"team","uuid":"{664512eb-246b-41e4-9fb3-de8e2003c064}","links":{"self":{"href":"https://api.bitbucket.org/2.0/teams/%7B664512eb-246b-41e4-9fb3-de8e2003c064%7D"},"html":{"href":"https://bitbucket.org/%7B664512eb-246b-41e4-9fb3-de8e2003c064%7D/"},"avatar":{"href":"https://bitbucket.org/account/myorg/avatar/"}}},"workspace":{"slug":"myorg","type":"workspace","name":"myorg","links":{"self":{"href":"https://api.bitbucket.org/2.0/workspaces/myorg"},"html":{"href":"https://bitbucket.org/myorg/"},"avatar":{"href":"https://bitbucket.org/workspaces/myorg/avatar/?ts=1614788230"}},"uuid":"{664512eb-246b-41e4-9fb3-de8e2003c064}"},"type":"repository","is_private":true,"name":"myservice"}
      

      But the relevant job not started automatically 
       
      When I started to record the following logs

      com.cloudbees.jenkins.plugins.BitbucketHookReceiver
      com.cloudbees.jenkins.plugins.BitBucketTrigger
      com.cloudbees.jenkins.plugins.BitbucketJobProbe
      com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor
      com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource
      com.cloudbees.jenkins.plugins.bitbucket.hooks
      com.cloudbees.jenkins.plugins.bitbucket.hooks.WebhookAutoRegisterListener
      

      I could see the following error log

      Considering candidate scmSourceOwner repositories » myorg » myapp
      Mar 07, 2021 6:26:22 PM FINER com.cloudbees.jenkins.plugins.BitbucketJobProbe
      Considering candidate scmSource com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource{id='com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator::https://bitbucket.org::myorg::myapp'}
      Mar 07, 2021 6:26:22 PM FINEST com.cloudbees.jenkins.plugins.BitbucketJobProbe
      SCMSource is [BitbucketSCMSource] which is not supported
      Mar 07, 2021 6:26:22 PM FINE com.cloudbees.jenkins.plugins.BitbucketJobProbe
      SCM [repositories » myorg » myapp] doesn't match remote repo [https://bitbucket.org/myorg/myapp]
      Mar 07, 2021 6:26:22 PM FINE com.cloudbees.jenkins.plugins.BitbucketJobProbe

      not working also for Multibranch Pipeline

      I couldn't find any solution here: https://issues.jenkins.io/browse/JENKINS-63848

          [JENKINS-65047] SCMSource is [BitbucketSCMSource] which is not supported

          Tzach Solomon added a comment -

          Tzach Solomon added a comment - dordor  maybe https://plugins.jenkins.io/bitbucket-push-and-pull-request/  plugin could help you? 

          dor s added a comment - - edited

          Actually I tested the plugin and I got a different isse: https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/issues/169

          About of how to reproduce the issue is very easy:

          just install bitbucket plugin & create multi branch pipeline with Bitbucket as a source

          dor s added a comment - - edited Actually I tested the plugin and I got a different isse: https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/issues/169 About of how to reproduce the issue is very easy: just install bitbucket plugin & create  multi branch pipeline with Bitbucket as a source

          Tzach Solomon added a comment -

          dordor BitbucketSCMSource belongs to https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSource.java so I can't really help here.
          I would suggest asking the plugin owner of bitbucket-branch-source-pluging

           

          I'm closing this one.
          If you need please re-open.

          Tzach Solomon added a comment - dordor  BitbucketSCMSource belongs to https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSource.java  so I can't really help here. I would suggest asking the plugin owner of bitbucket-branch-source-pluging   I'm closing this one. If you need please re-open.

          dor s added a comment - - edited

          tzach_solomon as you suggested, I'm trying to check the plugin  https://plugins.jenkins.io/bitbucket-push-and-pull-request/  which currently not working for me either.

          But, also the https://plugins.jenkins.io/bitbucket/ plugin isn't working for me as expected .

          I'm just trying to understand if the https://plugins.jenkins.io/bitbucket/ plugin should trigger jobs by webhooks when the branch source is Bitbucket and not git or not?

           

          if yes, it's very easy to reproduce this issue

          just use the following:

          jenkins 2.263.2
          Bitbucket Plugin 1.1.27
          Bitbucket Pipeline for Blue Ocean 1.24.4
          Bitbucket Branch Source Plugin 2.9.7
          

          then create Bitbucket branch source (see pic above) and just trigger webhook

          I can see in the code that BitbucketSCMSource is not supported for webhooks because it supports only GitSCM and MercurialSCM. Is that by design? 

          code :https://github.com/jenkinsci/bitbucket-plugin/blob/abf2a01527b000b701fc14263420c0eccd28db4b/src/main/java/com/cloudbees/jenkins/plugins/BitbucketJobProbe.java#L116-L152

           

          Note:  when I'm using Git Branch source instead of Bitbucket Branch source  it's working (see pic below) but without other functionally like PRs and Bitbucket post notifications. 

          dor s added a comment - - edited tzach_solomon  as you suggested, I'm trying to check the plugin   https://plugins.jenkins.io/bitbucket-push-and-pull-request/   which currently not working for me either. But, also the  https://plugins.jenkins.io/bitbucket/  plugin isn't working for me as expected . I'm just trying to understand if the  https://plugins.jenkins.io/bitbucket/  plugin should trigger jobs by webhooks when the branch source is Bitbucket and not git or not?   if yes, it's very easy to reproduce this issue just use the following: jenkins 2.263.2 Bitbucket Plugin 1.1.27 Bitbucket Pipeline for Blue Ocean 1.24.4 Bitbucket Branch Source Plugin 2.9.7 then create  Bitbucket  branch source (see pic above) and just trigger webhook I can see in the code that  BitbucketSCMSource  is not supported for webhooks because it supports only GitSCM and MercurialSCM . Is that by design?  code : https://github.com/jenkinsci/bitbucket-plugin/blob/abf2a01527b000b701fc14263420c0eccd28db4b/src/main/java/com/cloudbees/jenkins/plugins/BitbucketJobProbe.java#L116-L152   Note :  when I'm using  Git  Branch source instead of Bitbucket Branch source  it's working (see pic below) but without other functionally like PRs and Bitbucket post notifications. 

          Tzach Solomon added a comment -

          dordor it's by design since bitbucket-plugin does not even have the class BitbucketSCMSource.
          I hope this answer is more clear.

          Tzach Solomon added a comment - dordor  it's by design since bitbucket-plugin does not even have the class BitbucketSCMSource. I hope this answer is more clear.

          Hi tzach_solomon.
          I can easily understand the design decision behind it, but can't you implement a pragmatic approach either?
          For example: if the class is available on the classpath then you proceed with the logic through reflection (I know, it's very ugly and potentially breaking if not handled correctly).

          It's really a pity that you can scan and automatically create jobs for your organization, but then you cannot trigger them...

          Cosimo Damiano Prete added a comment - Hi tzach_solomon . I can easily understand the design decision behind it, but can't you implement a pragmatic approach either? For example: if the class is available on the classpath then you proceed with the logic through reflection (I know, it's very ugly and potentially breaking if not handled correctly). It's really a pity that you can scan and automatically create jobs for your organization, but then you cannot trigger them...

          Tzach Solomon added a comment - - edited

          tk35c

          1. I'm sorry you feel this, I truly am. You need to understand I'm NOT an employee of Atlasssian, I just maintain the plugin on my free time and if Atlasssian chose to create a separate plugin, I believe it was with a good cause.
          2. As for reflection, one does not simply do Java reflection. It has it's downsides (and risks) and in a major critical application such as Jenkins, I believe it's not a risk worth taking

          Tzach Solomon added a comment - - edited tk35c I'm sorry you feel this, I truly am. You need to understand I'm NOT an employee of Atlasssian, I just maintain the plugin on my free time and if Atlasssian chose to create a separate plugin, I believe it was with a good cause. As for reflection, one does not simply do Java reflection. It has it's downsides (and risks) and in a major critical application such as Jenkins, I believe it's not a risk worth taking

          Cosimo Damiano Prete added a comment - - edited

          Hi tzach_solomon.
          What about adding the Atlassian's plugin as provided ranged dependency and do the logic only if the Jar is there? In this way the only reflection would be a Class.forName(...) (to check if the classes are available) and then you could use the real classes.
          Would it be implementable in your opinion? If it's an acceptable solution for you, I can maybe submit a PR.

          Cosimo Damiano Prete added a comment - - edited Hi tzach_solomon . What about adding the Atlassian's plugin as provided ranged dependency and do the logic only if the Jar is there? In this way the only reflection would be a Class.forName(...) (to check if the classes are available) and then you could use the real classes. Would it be implementable in your opinion? If it's an acceptable solution for you, I can maybe submit a PR.

          Tzach Solomon added a comment - - edited

          tk35c I'm sorry but I won't start doing reflection on a plugin that supposed to be simple and do one simple thing

          Tzach Solomon added a comment - - edited tk35c  I'm sorry but I won't start doing reflection on a plugin that supposed to be simple and do one simple thing

          tzach_solomon fair enough. I'll check with my team how to proceed then.

          Thank you

          Cosimo Damiano Prete added a comment - tzach_solomon  fair enough. I'll check with my team how to proceed then. Thank you

            tzach_solomon Tzach Solomon
            dordor dor s
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: