jiraComment pipeline step throwing groovy.lang.MissingMethodException

75 views
Skip to first unread message

ST

unread,
Dec 23, 2020, 11:25:11 AM12/23/20
to Jenkins Users
I am trying to add a comment to a jira issue from my scripted pipeline with this command:
jiraComment(issueKey: 'FREF-363', body: 'My super jira comment')

And I'm getting the following error:
17:07:25  Caught exception (exception: 'groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[issueKey:FREF-363, body: My super jira comment]]
17:07:25  Possible solutions: wait(), chars(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure)', message: 'No signature of method: java.lang.String.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[issueKey:FREF-363, body:My super jira comment]]
17:07:25  Possible solutions: wait(), chars(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure)') during build, current build result is null.
[Pipeline] node
I am inside a node{} declaration, and I am not inside a @NonCPS method. What is wrong with my pipeline code?

Documentation for the step is here, I have basically copy&paste'd from here:

Also these other jira commands work just fine from the same scripted pipeline:
* jiraSearch
* step([$class: 'hudson.plugins.jira.JiraIssueUpdateBuilder', jqlSearch: … ])

And we are using Jenkins v2.271 and jira-plugin v3.1.3 (latest).

Any help much appreciated, I have the feelign I am missing something very simple here ;-)
 stefan.

ST

unread,
Jan 3, 2021, 4:06:20 PM1/3/21
to Jenkins Users
Anyone has any idea why jiraComment(issueKey, body) is not working for us in scripted pipeline, see below for exception message?

Anyone that can confirm that it works fine in a scripted pipeline with latest version of Jenkins and jira plugin? Otherwise I will file a bug issue in the next days.

Thanks,
 Stefan.

Arnaud bourree

unread,
Jan 4, 2021, 5:17:20 AM1/4/21
to jenkins...@googlegroups.com
Did you chek if you have Jira plugin installed?

Arnaud 

--
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/CABwQARtjA5%2Bv3WmCX%3DP4JmsNSpgvXWE%2BD_hmY0EaSJ4XEWavgQ%40mail.gmail.com.

ST

unread,
Jan 4, 2021, 4:17:00 PM1/4/21
to Jenkins Users
Yes, we have installed latest version of jira plugin 3.1.3. Also I am successfully calling jiraSearch() method from the same plugin a few lines above in the same scripted pipeline.

FYI Here is the documentation of the Pipeline API of the jira plugin: https://github.com/jenkinsci/jira-plugin/blob/master/COMPATIBILITY.md

For the reference here is the exception again from my first email that I'm getting - any other ideas what could be the reason for getting this groovy exception?
Caught exception (exception: 'groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[issueKey:FREF-363, body: My super jira comment]]

Reinhold Füreder

unread,
Jan 12, 2021, 10:14:23 AM1/12/21
to jenkins...@googlegroups.com

Hello Stefan,

 

I think the documentation of the plugin is slightly outdated (or maybe only “COMPATIBILITY.md”):

 

  • I think this should work:

jiraComment('FREF-363', 'My super jira comment')

 

HTH Reinhold

 

P.S.: Not sure if “COMPATIBILITY.md” is supposed to be the pipeline step documentation. If so, you may want to make a little PR with the updated usage?

ST

unread,
Jan 13, 2021, 4:39:09 PM1/13/21
to Jenkins Users
Hi Reinhold,

Thanks for your suggestion! I just tried to use non-named arguments:

jiraComment('FREF-363', 'My super jira comment')
But that did not work either, it threw this exception:

[Pipeline] End of Pipeline
java.lang.IllegalArgumentException: Expected named arguments but got [FREF-363, My super jira comment]
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:708)
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:640)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:234)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at jdk.internal.reflect.GeneratedMethodAccessor264.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:142)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.notifyIssueTrackerIfApplicable(WorkflowScript:239)
at WorkflowScript.run(WorkflowScript:62)
at ___cps.transform___(Native Method)
[...]

Reinhold Füreder

unread,
Jan 14, 2021, 1:22:52 AM1/14/21
to jenkins...@googlegroups.com

Hi Stefan,

 

I am really sorry for my bad naïve guess:

  • Actually your call should really work, or at least it worked for me (even if I have neither JIRA, nor a Jenkins JIRA configuration), thus at least the pipeline code seems OK.
  • (Admittedly rather sadly is that under this conditions -- missing JIRA and Jenkins JIRA configuration -- I would expect the pipeline to fail, but it did not; and there was not even an error log!)

 

Please note that I used the example from “COMPATIBILITY.md”:

jiraComment(issueKey: "EX-111", body: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) builded. Please go to ${env.BUILD_URL}.")

… as well as your call as-is…

 

Maybe Arnauds hint points into the right direction: are the JIRA plugin and all its (transitive) dependencies installed correctly?

 

HTH Reinhold

Reply all
Reply to author
Forward
0 new messages