Issue with cps-method-mismatches

93 views
Skip to first unread message

Stefan.R...@tk.de

unread,
Jul 30, 2019, 4:18:09 PM7/30/19
to jenkins...@googlegroups.com
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
 
 

Stefan.R...@tk.de

unread,
Oct 23, 2019, 9:06:42 AM10/23/19
to jenkins...@googlegroups.com
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: jenkins...@googlegroups.com
Betreff: Issue with cps-method-mismatches

Reinhold Füreder

unread,
Oct 23, 2019, 9:36:57 AM10/23/19
to jenkins...@googlegroups.com

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

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9fbfb50b0e6447649044dd69d43ac6b4%40tk.de.

Stefan.R...@tk.de

unread,
Oct 23, 2019, 10:15:03 AM10/23/19
to jenkins...@googlegroups.com

Hi Reinhold,

 

in can't believe, it was that easy… Thanks, your guess worked!!!

 

Regards

Stefan

 

 

Von: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] Im Auftrag von Reinhold Füreder
Gesendet: Mittwoch, 23. Oktober 2019 15:36
An: jenkins...@googlegroups.com
Betreff: RE: Issue with cps-method-mismatches

 

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:

Reply all
Reply to author
Forward
0 new messages