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


From: [email protected] <[email protected]> On 
Behalf Of ST
Sent: Mittwoch, 13. Jänner 2021 22:39
To: Jenkins Users <[email protected]>
Subject: Re: jiraComment pipeline step throwing 
groovy.lang.MissingMethodException

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)
[...]

On Tue, Jan 12, 2021 at 4:14 PM Reinhold Füreder 
<[email protected]<mailto:[email protected]>> wrote:
Hello Stefan,

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

  *   
https://www.jenkins.io/doc/pipeline/steps/jira/#jiracomment-jira-add-a-comment-to-issues
  *   
https://github.com/jenkinsci/jira-plugin/blob/1dacc167a9b21fc4d9256866a5f67ef741af7805/src/main/java/hudson/plugins/jira/pipeline/CommentStep.java#L30


  *   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?


From: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> On 
Behalf Of ST
Sent: Montag, 4. Jänner 2021 22:17
To: Jenkins Users 
<[email protected]<mailto:[email protected]>>
Subject: Re: jiraComment pipeline step throwing 
groovy.lang.MissingMethodException

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]]

On Mon, Jan 4, 2021 at 11:17 AM Arnaud bourree 
<[email protected]<mailto:[email protected]>> wrote:
Did you chek if you have Jira plugin installed?

Arnaud

Le dim. 3 janv. 2021 à 22:06, ST 
<[email protected]<mailto:[email protected]>> a écrit :
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.
On Wed, 23 Dec 2020, 17:24 ST, 
<[email protected]<mailto:[email protected]>> wrote:
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:
https://github.com/jenkinsci/jira-plugin/blob/master/COMPATIBILITY.md#commentstep

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.

--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CABwQARtjA5%2Bv3WmCX%3DP4JmsNSpgvXWE%2BD_hmY0EaSJ4XEWavgQ%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CABwQARtjA5%2Bv3WmCX%3DP4JmsNSpgvXWE%2BD_hmY0EaSJ4XEWavgQ%40mail.gmail.com?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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAESUf_A7TKXSgcj%3DbEaAWBSQOaTZTSf1%2BsL2RkMgtKaEm3SC%2Bg%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAESUf_A7TKXSgcj%3DbEaAWBSQOaTZTSf1%2BsL2RkMgtKaEm3SC%2Bg%40mail.gmail.com?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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CABwQARuoPuSK_jiH_aMiHrF3Pfz2ud_5DGQ2oU-dJeJKkyKZgA%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CABwQARuoPuSK_jiH_aMiHrF3Pfz2ud_5DGQ2oU-dJeJKkyKZgA%40mail.gmail.com?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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/VI1PR01MB663836D3ED65D32190424718F7AA0%40VI1PR01MB6638.eurprd01.prod.exchangelabs.com<https://groups.google.com/d/msgid/jenkinsci-users/VI1PR01MB663836D3ED65D32190424718F7AA0%40VI1PR01MB6638.eurprd01.prod.exchangelabs.com?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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CABwQARvWCPqCCx_%3Dr%2BHs2o%3DmmbcEpuoxj%2B3BZwvkbpNwifvRRA%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CABwQARvWCPqCCx_%3Dr%2BHs2o%3DmmbcEpuoxj%2B3BZwvkbpNwifvRRA%40mail.gmail.com?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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/VI1PR01MB6638C1A2AC8EE02730CE6749F7A80%40VI1PR01MB6638.eurprd01.prod.exchangelabs.com.

Reply via email to