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

Multibranch build strategy extension plugin throws BitbucketSCMSource cannot be cast to AbstractGitSCMSource

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Ubuntu 18.04, Jenkins 2.191, Bitbucket Branch Source Plugin 2.4.6,
      SCM API Plugin 2.6.3, Git plugin 3.12.0,

      I'm using a Multibranch Pipeline Project with the Bitbucket Branch Sources Plugin.

      Currently I get an exception when setting a included or excluded build strategy.

      In the Jenkins log file the output is:

       

      2019-08-28 08:43:18.576+0000 [id=13442] INFO    c.i.j.p.m.b.IncludeRegionBranchBuildStrategy#isAutomaticBuild: Included regions: [hub/azuredeploy.json, hub/azuredeploy.parameters.json, hub/Jenkinsfile]
      2019-08-28 08:43:18.577+0000 [id=13442] SEVERE  c.i.j.p.m.b.IncludeRegionBranchBuildStrategy#isAutomaticBuild: Unecpected exception
      java.lang.ClassCastException: com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource cannot be cast to jenkins.plugins.git.AbstractGitSCMSource
              at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:378)
              at com.igalg.jenkins.plugins.multibranch.buildstrategy.BranchBuildStrategyExtension.buildSCMFileSystem(BranchBuildStrategyExtension.java:55)
              at com.igalg.jenkins.plugins.multibranch.buildstrategy.IncludeRegionBranchBuildStrategy.isAutomaticBuild(IncludeRegionBranchBuildStrategy.java:96)
              at jenkins.branch.BranchBuildStrategy.automaticBuild(BranchBuildStrategy.java:260)
              at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.isAutomaticBuild(MultiBranchProject.java:2246)
              at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.doAutomaticBuilds(MultiBranchProject.java:2197)
              at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observeExisting(MultiBranchProject.java:2023)
              at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1983)
              at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:357)
              at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrievePullRequests(BitbucketSCMSource.java:675)
              at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:593)
              at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
              at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
              at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:635)
              at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
              at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:164)
              at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1026)
              at hudson.model.ResourceController.execute(ResourceController.java:97)
              at hudson.model.Executor.run(Executor.java:429)
      
      
      

      This was working a day before because in the same Jenkins log file i got

       

      2019-08-27 11:43:01.029+0000 [id=29996] INFO c.i.j.p.m.b.IncludeRegionBranchBuildStrategy#isAutomaticBuild: Included regions: [hub/azuredeploy.json, hub/azuredeploy.parameters.json, hub/Jenkinsfile]

       

       

      Between these two log outputs I have updated/installed the following plugins:

       

      2019-08-27 16:08:44.379+0000 [id=207351] INFO hudson.PluginManager#install: Starting installation of a batch of 1 plugins plus their dependencies
      2019-08-27 16:08:45.130+0000 [id=273261] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of scm-filter-branch-pr on behalf of bfed
      2019-08-27 16:08:45.779+0000 [id=273261] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading scm-filter-branch-pr
      2019-08-27 16:09:03.899+0000 [id=268812] INFO hudson.PluginManager#install: Starting installation of a batch of 4 plugins plus their dependencies
      2019-08-27 16:09:03.900+0000 [id=273567] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of git-client on behalf of bfed
      2019-08-27 16:09:04.755+0000 [id=273567] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading git-client
      2019-08-27 16:09:27.229+0000 [id=273567] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of cloudbees-bitbucket-branch-source on behalf of bfed
      2019-08-27 16:09:27.756+0000 [id=273567] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading cloudbees-bitbucket-branch-source
      2019-08-27 16:09:35.054+0000 [id=273567] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of workflow-job on behalf of bfed
      2019-08-27 16:09:35.575+0000 [id=273567] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading workflow-job
      2019-08-27 16:09:36.672+0000 [id=273567] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of jira on behalf of bfed
      2019-08-27 16:09:37.204+0000 [id=273567] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading jira
      2019-08-27 16:12:44.429+0000 [id=266688] INFO hudson.PluginManager#install: Starting installation of a batch of 2 plugins plus their dependencies
      2019-08-27 16:12:44.431+0000 [id=274936] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of scm-filter-branch-pr on behalf of bfed
      2019-08-27 16:12:44.431+0000 [id=274936] INFO h.m.UpdateCenter$InstallationJob#_run: Skipping duplicate install of: SCM Filter Branch PR@0.4
      2019-08-27 16:12:44.431+0000 [id=274936] INFO h.model.UpdateCenter$DownloadJob#run: Installation successful: scm-filter-branch-pr
      2019-08-27 16:12:44.431+0000 [id=274936] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of bitbucket-scm-filter-aged-refs on behalf of bfed
      2019-08-27 16:12:45.409+0000 [id=274936] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading bitbucket-scm-filter-aged-refs
      
       
      

      Could it be that the update from the cloudbees-bitbucket-branch-source Plugin causes the exception?

          [JENKINS-59121] Multibranch build strategy extension plugin throws BitbucketSCMSource cannot be cast to AbstractGitSCMSource

          Igal Gluh added a comment -

          Benjamin Hi,

          Can you please share yours job configuration ?

          Igal Gluh added a comment - Benjamin Hi, Can you please share yours job configuration ?

          Vinod Mohanan added a comment -

          Hello igal,

           

          We are also facing the same problem:

          I have tried the three options (include/exclude/cancel by ci strategy) in all cases the build gets kicked off.

          Build Strategies is a new thing that we are trying out, but ahve had no success with it. The jenkins log gave this message

          2020-08-05 18:06:01.801+0000 [id=2624]	SEVERE	c.i.j.p.m.b.ExcludeByIgnoreFileBranchBuildStrategy#isAutomaticBuild: Unecpected exception
          java.lang.ClassCastException: com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource cannot be cast to jenkins.plugins.git.AbstractGitSCMSource
          	at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:379)
          	at com.igalg.jenkins.plugins.multibranch.buildstrategy.BranchBuildStrategyExtension.buildSCMFileSystem(BranchBuildStrategyExtension.java:55)
          	at com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeByIgnoreFileBranchBuildStrategy.isAutomaticBuild(ExcludeByIgnoreFileBranchBuildStrategy.java:90)
          	at jenkins.branch.BranchBuildStrategy.automaticBuild(BranchBuildStrategy.java:260)
          	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.isAutomaticBuild(MultiBranchProject.java:2252)
          	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.doAutomaticBuilds(MultiBranchProject.java:2203)
          	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observeExisting(MultiBranchProject.java:2029)
          	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1989)
          	at jenkins.scm.api.SCMHeadObserver$Wrapped.observe(SCMHeadObserver.java:637)
          	at jenkins.scm.api.SCMHeadEvent$Validated.observe(SCMHeadEvent.java:295)
          	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:357)
          	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrievePullRequests(BitbucketSCMSource.java:674)
          	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:593)
          	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
          	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:327)
          	at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.processHeadUpdate(MultiBranchProject.java:1590)
          	at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.onSCMHeadEvent(MultiBranchProject.java:1190)
          	at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:246)
          	at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:229)
          	at jenkins.scm.api.SCMEvent$Dispatcher.run(SCMEvent.java:505)
          	at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
          	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          	at java.lang.Thread.run(Thread.java:748)
          

          We are using Bitbucket server for scm.

          Bitbucket Branch Source. - 2.9.0

          Pipeline: Multibranch build strategy extension  - 1.0.10

          Here is a snippet of the job configuration

           

          Vinod Mohanan added a comment - Hello igal,   We are also facing the same problem: I have tried the three options (include/exclude/cancel by ci strategy) in all cases the build gets kicked off. Build Strategies is a new thing that we are trying out, but ahve had no success with it. The jenkins log gave this message 2020-08-05 18:06:01.801+0000 [id=2624] SEVERE c.i.j.p.m.b.ExcludeByIgnoreFileBranchBuildStrategy#isAutomaticBuild: Unecpected exception java.lang.ClassCastException: com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource cannot be cast to jenkins.plugins.git.AbstractGitSCMSource at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:379) at com.igalg.jenkins.plugins.multibranch.buildstrategy.BranchBuildStrategyExtension.buildSCMFileSystem(BranchBuildStrategyExtension.java:55) at com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeByIgnoreFileBranchBuildStrategy.isAutomaticBuild(ExcludeByIgnoreFileBranchBuildStrategy.java:90) at jenkins.branch.BranchBuildStrategy.automaticBuild(BranchBuildStrategy.java:260) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.isAutomaticBuild(MultiBranchProject.java:2252) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.doAutomaticBuilds(MultiBranchProject.java:2203) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observeExisting(MultiBranchProject.java:2029) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1989) at jenkins.scm.api.SCMHeadObserver$Wrapped.observe(SCMHeadObserver.java:637) at jenkins.scm.api.SCMHeadEvent$Validated.observe(SCMHeadEvent.java:295) at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:357) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrievePullRequests(BitbucketSCMSource.java:674) at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:593) at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:327) at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.processHeadUpdate(MultiBranchProject.java:1590) at jenkins.branch.MultiBranchProject$SCMEventListenerImpl.onSCMHeadEvent(MultiBranchProject.java:1190) at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:246) at jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:229) at jenkins.scm.api.SCMEvent$Dispatcher.run(SCMEvent.java:505) at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) We are using Bitbucket server for scm. Bitbucket Branch Source. - 2.9.0 Pipeline: Multibranch build strategy extension  - 1.0.10 Here is a snippet of the job configuration  

            igalg Igal Gluh
            bfederau Benjamin Federau
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: