Hi Stefan,

Just a naïve guess: This might be a little bug in Jenkins pipeline, but you 
should be able to work around it…

“action” in pipeline file is named argument map element for custom “someStep” 
step

Therefore in custom “someStep” step:

additionalActions.action …  might still work
but additionalActions.action() doesn’t work (anymore since about mid July 2019)


  *   Try:
additionalActions.action.call()

HTH Reinhold


From: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> On 
Behalf Of stefan.rademac...@tk.de
Sent: Mittwoch, 23. Oktober 2019 15:07
To: jenkinsci-users@googlegroups.com
Subject: WG: Issue with cps-method-mismatches

Hi everyone,

it's been a while, since I asked the question below. I still couldn't figure 
out, what 'm doing wrong.
Is there anyone, who has a hint?

Thanks!
Stefan

_____________________________________________
Von: Rademacher, Stefan
Gesendet: Dienstag, 30. Juli 2019 14:04
An: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>
Betreff: Issue with cps-method-mismatches


Hi everyone,

my Jenkins Pipeline prints the following message:
expected to call java.util.LinkedHashMap.action but wound up catching 
org.jenkinsci.plugins.workflow.cps.CpsClosure2.call

The Jenkinsfile is
pipeline {
  agent { label "Linux-Agent" }
  stages {
    stage("Stage") {
      steps {
        someStep(
          action: { sh "echo FOO" }
        )
      }
    }
  }
}

This ist he custom step 'someStep.groovy':
def call(additionalActions) {
  if (additionalActions.action) additionalActions.action()
}

Console output:
Running on Linux-Test (rdev40v59) in 
/data/jenkins-agent/workspace/Jenkins-Shared-Libs/testjob
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Stage)
expected to call java.util.LinkedHashMap.action but wound up catching 
org.jenkinsci.plugins.workflow.cps.CpsClosure2.call; see: 
https://jenkins.io/redirect/pipeline-cps-method-mismatches/
[Pipeline] sh
+ echo FOO
FOO
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

I have read https://jenkins.io/redirect/pipeline-cps-method-mismatches/, but 
can't figure out, why this error message occurs in my case.
Can anyone help me to find a solution?

Best regards
Stefan


--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9fbfb50b0e6447649044dd69d43ac6b4%40tk.de<https://groups.google.com/d/msgid/jenkinsci-users/9fbfb50b0e6447649044dd69d43ac6b4%40tk.de?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/AM0PR01MB6147305B7F0F1D2AC8B19F42F76B0%40AM0PR01MB6147.eurprd01.prod.exchangelabs.com.

Reply via email to