-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins: 2.222.1
Copy Artifact Plugin: 1.43.1
Using the Jenkinsfile below as an example of a declarative pipeline with buildSelector as a parameter:
pipeline { agent any parameters { buildSelector(defaultSelector: lastSuccessful(), description: 'Build Selector', name: 'BUILD_SELECTOR') } stages { stage('Test') { steps { copyArtifacts fingerprintArtifacts: true, projectName: 'TEST', selector: buildParameter('BUILD_SELECTOR') } } } }
The Jenkins job will fail with the following error in the logs (full stack trace attached):
2020-04-04 06:34:24.037+0000 [id=302] WARNING o.j.p.w.cps.CpsThreadGroup#saveProgramIfPossible: program state save failed an exception which occurred: in field hudson.plugins.copyartifact.BuildSelectorParameter.defaultSelector in object hudson.plugins.copyartifact.BuildSelectorParameter@cae80c2 in field org.jenkinsci.plugins.pipeline.modeldefinition.model.Parameters.parameters in object org.jenkinsci.plugins.pipeline.modeldefinition.model.Parameters@cae9042 in field org.jenkinsci.plugins.pipeline.modeldefinition.model.Root.parameters in object org.jenkinsci.plugins.pipeline.modeldefinition.model.Root@3a89bd59 in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@3bd8ad5b in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@27aee8de in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.TryBlockEnv@5b2d2915 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@75a332f6 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@570f35f2 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4e440f3c in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@43b3619b in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@637efe56 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@5c1f8e4c in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@1862a28 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@59f8040d in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@e7adb89 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@78865c91 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@35eaa3e5 in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture in object com.cloudbees.groovy.cps.impl.CpsClosureDef@e3560f9 in field com.cloudbees.groovy.cps.impl.CpsClosure.def in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@1ffc8194 in field groovy.lang.Closure.delegate in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@7d4b25d3 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2e560f1f in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2e560f1f Caused: java.io.NotSerializableException: hudson.plugins.copyartifact.StatusBuildSelector