jenkins-library: Pipeline CPS method mismatch
I’ve noticed log lines like
13:07:26 --- Begin library step of: mavenExecute ---
expected to call com.sap.piper.ConfigurationHelper.use but wound up catching com.sap.piper.MapUtils.deepCopy; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
expected to call com.sap.piper.analytics.Telemetry$_getInstance_closure1.call but wound up catching com.sap.piper.analytics.Telemetry.piperOsDefaultReporting; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
in our Pipeline today. On a Jenkins instance, those are “just” warnings, but in Jenkinsfile runner this throws an exception (see here).
I’ve pushed a reproducer to https://github.com/fwilhe/repro-cps-issue
Stacktrace:
java.lang.IllegalStateException: expected to call com.sap.piper.ConfigurationHelper.use but wound up catching com.sap.piper.MapUtils.deepCopy; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.handleMismatch(CpsVmExecutorService.java:117)
at com.cloudbees.groovy.cps.impl.CpsCallableInvocation.checkMismatch(CpsCallableInvocation.java:63)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:94)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
It also fails in our travis tests, for example https://www.travis-ci.com/SAP/devops-docker-cf-cli/builds/118754878
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (20 by maintainers)
I would like to share some preliminary findings: I removed some
@NonCPS
annotations from the well known commonly used classes (basically the ConfigurationFramework). An example pipeline continues working without these@NonCPS
annotations. So I guess a lot of these annotations are not needed (anymore). I guess some annotations has been introduced in order to workaround bugs (e.g. this one) which is resolved in the meantime.My experimental version is here: https://github.com/marcusholl/jenkins-library/tree/experiments/nonCPS