-
Improvement
-
Resolution: Fixed
-
Blocker
-
Docker image jenkins/jenkins:2.190.3 in a docker network with a Perforce instance (https://github.com/p4paul/helix-docker) using p4-plugin 1.10.7 and
Pipeline: Multibranch with defaults 2.1
When using the p4 plugin and the Pipeline: Multibranch with defaults plugin, scanning a multibranch pipeline with a default Jenkinsfile results in a java.lang.ClassCastException.
To reproduce, I used the jenkins/jenkins:2.190.3 docker image of Jenkins with p4-plugin (1.10.7) and the Pipeline: Multibranch with defaults plugin (2.1), as well as a clean docker instance of Perforce (https://github.com/p4paul/helix-docker). I created a stream depot with a couple of dummy streams to use for tests.
I created a new multibranch pipeline, set up the Branch source to be the p4 depot with the dummy streams, and set the Build configuration to use by default Jenkinsfile.
It results in the following output:
Started by user admin [Thu Nov 28 16:40:12 UTC 2019] Starting branch indexing... ... p4 streams //testDepot/... +ERROR: [Thu Nov 28 16:40:12 UTC 2019] Could not fetch branches from source f9f7c9b6-5fe3-4b7b-bec1-b56ed976ef85 java.lang.ClassCastException: org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactory cannot be cast to org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.getLastScan(AbstractP4ScmSource.java:383) at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.getRevision(AbstractP4ScmSource.java:310) at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.retrieve(AbstractP4ScmSource.java:158) Caused: java.io.IOException at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.retrieve(AbstractP4ScmSource.java:194) 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) [Thu Nov 28 16:40:12 UTC 2019] Finished branch indexing. Indexing took 92 ms FATAL: Failed to recompute children of testMultibranchDefaults2 java.io.IOException: java.lang.ClassCastException: org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactory cannot be cast to org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.retrieve(AbstractP4ScmSource.java:194) 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) Caused by: java.lang.ClassCastException: org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactory cannot be cast to org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.getLastScan(AbstractP4ScmSource.java:383) at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.getRevision(AbstractP4ScmSource.java:310) at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.retrieve(AbstractP4ScmSource.java:158) ... 8 more Finished: FAILURE
Changing the Build configuration back to by Jenkinsfile, the pipeline scans without error.