0

The last stage of my Jenkins Pipeline is not working :

         stage('Integration with Jira') {
           steps {
               jiraComment(issueKey: "P34AMA-204", body: "test")
            }
         }

It ends with the folloing error

java.lang.NullPointerException
    at hudson.plugins.jira.JiraSite.**createSession**(JiraSite.java:530)
    at hudson.plugins.jira.JiraSite.getSession(JiraSite.java:506)
    at hudson.plugins.jira.pipeline.CommentStep$CommentStepExecution.run(CommentStep.java:83)
    at hudson.plugins.jira.pipeline.CommentStep$CommentStepExecution.run(CommentStep.java:64)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    at hudson.security.ACL.impersonate(ACL.java:367)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Finished: FAILURE
  • Jenkins version is 2.263.3
  • Jira (version 8.20.7) is configured the following way in Jenkins jiraConfiguration with the Jira plugin version 3.0.15

I don't have admin access to check the logs, such as suggested here : Jira plugin in Jenkins not working but No error (the Jenkins server belongs to the company I work for)

I believe this might be happening because I do not have permission to define Scoped credentials, under Credentials > System > Global Credentials

enter image description here

Either that or perhaps I might need to configure the Jira API Key in Jenkins youtube.com/watch?v=-KrlCWVPfJM (minute 3:30)

Would you have any hint on why this is happening?

1 Answers1

0

I'd say something was up with your Jira site configuration as hinted by the error. I'm not sure if I'm using the same Jira plugin as you are but in my case, in the Jira sites configuration, the "URL" field has been set to the base link of Jira (the link you have set under "Link URL"). The "Link URL" field has been left blank. All other configurations are the same.

Another thing I noted is that my add comment pipeline syntax is different to yours, and looks like this:

jiraAddComment(idOrKey: <jira-id>, input: "test")

But once again, I'm not sure we are using the same plugins (or versions), so the syntax difference could be irrelevant. Try changing the two things and see, since the comment function works just fine for me.

M B
  • 2,700
  • 2
  • 15
  • 20
  • Thank you a lot for your answer! Correct! I believe we have different plugins. I just made the modifications such as your configuration and now a different error shows up : "No such DSL method 'jiraAddComment'". I just realized that the argument idOrKey belongs to a plugin called "Jira Pipeline Steps" https://www.jenkins.io/doc/pipeline/steps/jira-steps/ , and I do not have that plugin installed. The one I seem to have is https://plugins.jenkins.io/jira/ (can not be 100% sure since I do not have access to the Manage Jenkins > Configure System menu) – Claudia Martins Nov 26 '22 at 08:47
  • Regarding the comment above , this syntaxe : jiraAddComment idOrKey: id, comment: 'Hi there!' ; belongs to another plugin --> jira-steps-plugin (https://stackoverflow.com/questions/44001016/how-to-add-comment-to-jira-issue-from-jenkins-pipeline ) – Claudia Martins Nov 26 '22 at 17:24
  • Did you try changing the Jira site configuration – M B Nov 27 '22 at 02:41
  • Yes, I tried changing the Jira site configuration in Jenkins several times, i.e., leaving the Link Url empty or not, trying different Url links (https://jira-mut.d.bbg/, https://jira-mut.d.bbg/browse/P34AMA-204 and https://jira-mut.d.bbg/login.jsp?nosso&os_destination=%2Fbrowse%2FP34AMA-204), checking and unchecking the "Use HTTP authentication instead of normal login" checkbox – Claudia Martins Nov 27 '22 at 18:19