Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51243

Use JiraTestReporter plugin in Jenkins pipeline(Groovy) type of job.

      We are using pipeline type of jobs in jenkins so can we use JiraTestResultReporter plugin for pipeline type jobs?

      Is pipeline supported for JiraTestResultReporter plugin? If yes how can we use it in our pipeline job.

          [JENKINS-51243] Use JiraTestReporter plugin in Jenkins pipeline(Groovy) type of job.

          manus added a comment -

          We have the same need, tried some hacky stuff (failed), and asked about it on the #jenkins IRC channel, but it seems to not currently be possible to use this plugin in a declarative pipeline project.

          Indeed, the documentation only mentions Freestyle, Multi-configuration, or Maven as the explicitly-supported project types. Even so, when attempting to use it as documented I seem to run into JENKINS-49819, so I'm completely blocked from using this plugin at all.

          Really hoping to get some insight from the plugin's maintainers! (maplesteve, catalinluta, andreituicu) Thanks in advance!

          manus added a comment - We have the same need, tried some hacky stuff (failed), and asked about it  on the #jenkins IRC channel, but it seems to not currently be possible to use this plugin in a declarative pipeline project. Indeed, the documentation only mentions Freestyle, Multi-configuration, or Maven as the explicitly-supported project types. Even so, when attempting to use it as documented I seem to run into JENKINS-49819 , so I'm completely blocked from using this plugin at all. Really hoping to get some insight from the plugin's maintainers! ( maplesteve , catalinluta , andreituicu ) Thanks in advance!

          Catalin Luta added a comment -

          Hey manus, aashish89. Sorry for the long pause. We've had a rough patch at work and couldn't look after the plugin for a while. For the record, we do use it as a part of a pipeline project, but a bit hackish.

          We have some time next week to investigate and get back to you with some info.

          Catalin Luta added a comment - Hey manus , aashish89 . Sorry for the long pause. We've had a rough patch at work and couldn't look after the plugin for a while. For the record, we do use it as a part of a pipeline project, but a bit hackish. We have some time next week to investigate and get back to you with some info.

          Catalin Luta added a comment - - edited

          manus, aashish89, we've looked a bit at the pipeline integration and found a bug in our code that is preventing the plug-in to run accordingly. We'll get back to you with an ETA while we continue our investigation. In the meantime, manus, let's please jump on JENKINS-49819.

          Catalin Luta added a comment - - edited manus , aashish89 , we've looked a bit at the pipeline integration and found a bug in our code that is preventing the plug-in to run accordingly. We'll get back to you with an ETA while we continue our investigation. In the meantime, manus , let's please jump on JENKINS-49819 .

          manus added a comment -

          Thanks for the update! Please let me know if there's anything I can provide to help troubleshoot this. Until then, I'll see if I can help out with JENKINS-49819.

          manus added a comment - Thanks for the update! Please let me know if there's anything I can provide to help troubleshoot this. Until then, I'll see if I can help out with JENKINS-49819 .

          Hey Catalin thanks for the update. Please revert back as soon as you are able to get the pipeline code working.

          Thanks.

          Aashish Rajguru added a comment - Hey Catalin thanks for the update. Please revert back as soon as you are able to get the pipeline code working. Thanks.

          Hey Catalin, till when can we get the pipeline issue resolved?

          Aashish Rajguru added a comment - Hey Catalin, till when can we get the pipeline issue resolved?

          Code changed in jenkins
          User: Andrei Tuicu
          Path:
          src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraTestAction.java
          src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraTestDataPublisher.java
          src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraUtils.java
          src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JobConfigMapping.java
          http://jenkins-ci.org/commit/JiraTestResultReporter-plugin/e256166c8c7f95fc92e481ff40616285892b3d23
          Log:
          JENKINS-51243 - Use JiraTestReporter plugin in Jenkins pipeline(Groovy) type of job

          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrei Tuicu Path: src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraTestAction.java src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraTestDataPublisher.java src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JiraUtils.java src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/JobConfigMapping.java http://jenkins-ci.org/commit/JiraTestResultReporter-plugin/e256166c8c7f95fc92e481ff40616285892b3d23 Log: JENKINS-51243 - Use JiraTestReporter plugin in Jenkins pipeline(Groovy) type of job * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Catalin Luta added a comment -

          aashish89, manus, as you probably saw, andreituicu pushed a potential fix to the repo. We don't have time right now to test it thoroughly, but we have put some time aside for the release on the 5th of June. If you have time and know your way around snapshot builds, you can give it a go and test it out. Let us know if you find anything!

          Catalin Luta added a comment - aashish89 , manus , as you probably saw, andreituicu pushed a potential fix to the repo. We don't have time right now to test it thoroughly, but we have put some time aside for the release on the 5th of June. If you have time and know your way around snapshot builds, you can give it a go and test it out. Let us know if you find anything!

          Aashish Rajguru added a comment - - edited

          Hi Catalin,

          Thanks for the update. I cloned the branch issue/JENKINS-51243. And when i try to build the project i get compilation error.

          Below are the version details:

          admins-MacBook-Pro-2:JiraTestResultReporter-plugin-master aashish$ mvn -v

          Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T01:19:05+05:30)

          Maven home: /usr/local/Cellar/maven/3.5.3/libexec

          Java version: 10.0.1, vendor: Oracle Corporation

          Java home: /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home

          Default locale: en_IN, platform encoding: UTF-8

          OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"

           

          Below is the snippet of the error.

          [ERROR] COMPILATION ERROR :

          [INFO] -------------------------------------------------------------

          [ERROR] java.nio.file.NoSuchFileException: /Users/aashish/Project_Stuff/JiraTestResultReporter-plugin-issue-JENKINS-51243/target/classes/META-INF/annotations/hudson.Extension

          [INFO] 1 error

          [INFO] -------------------------------------------------------------

          [INFO] ------------------------------------------------------------------------

          [INFO] BUILD FAILURE

          [INFO] ------------------------------------------------------------------------

          [INFO] Total time: 11.569 s

          [INFO] Finished at: 2018-05-25T13:08:24+05:30

          [INFO] ------------------------------------------------------------------------

          [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project JiraTestResultReporter: Compilation failure

          [ERROR] java.nio.file.NoSuchFileException: /Users/aashish/Project_Stuff/JiraTestResultReporter-plugin-issue-JENKINS-51243/target/classes/META-INF/annotations/hudson.Extension

          [ERROR]

          [ERROR] -> [Help 1]

          [ERROR]

          [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

          [ERROR] Re-run Maven using the -X switch to enable full debug logging.

          [ERROR]

          [ERROR] For more information about the errors and possible solutions, please read the following articles:

          [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

           

          Can you please look into it.

           

          Aashish Rajguru added a comment - - edited Hi Catalin, Thanks for the update. I cloned the branch  issue/JENKINS-51243 . And when i try to build the project i get compilation error. Below are the version details: admins-MacBook-Pro-2:JiraTestResultReporter-plugin-master aashish$ mvn -v Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T01:19:05+05:30) Maven home: /usr/local/Cellar/maven/3.5.3/libexec Java version: 10.0.1, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home Default locale: en_IN, platform encoding: UTF-8 OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"   Below is the snippet of the error. [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] java.nio.file.NoSuchFileException: /Users/aashish/Project_Stuff/JiraTestResultReporter-plugin-issue- JENKINS-51243 /target/classes/META-INF/annotations/hudson.Extension [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.569 s [INFO] Finished at: 2018-05-25T13:08:24+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project JiraTestResultReporter: Compilation failure [ERROR] java.nio.file.NoSuchFileException: /Users/aashish/Project_Stuff/JiraTestResultReporter-plugin-issue- JENKINS-51243 /target/classes/META-INF/annotations/hudson.Extension [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException   Can you please look into it.  

          Hey Catalin,

          I tried to run mvn hpi:hpi directly it works fine with no errors. But, mean while mvn install, mvn package still fails.

          Can i use the .hpi file for installing the plugin even if mvn install and mvn package are failing?

          Aashish Rajguru added a comment - Hey Catalin, I tried to run mvn hpi:hpi directly it works fine with no errors. But, mean while mvn install, mvn package still fails. Can i use the .hpi file for installing the plugin even if mvn install and mvn package are failing?

          Catalin Luta added a comment -

          Hey aashish89, the build works fine for me. You should check your maven settings and see that everything is correctly set. You can have a look at https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial for maven repos and other settings.

          Catalin Luta added a comment - Hey aashish89 , the build works fine for me. You should check your maven settings and see that everything is correctly set. You can have a look at https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial for maven repos and other settings.

          Hi Catalin,

          With JDK version 8 it is working fine. I was trying to compile it with JDK version 10.

          Aashish Rajguru added a comment - Hi Catalin, With JDK version 8 it is working fine. I was trying to compile it with JDK version 10.

          Hi Catalin,

          After i install the JiraTestResultReporter.hpi file and reboot Jenkins will the snippet generator work?

          Aashish Rajguru added a comment - Hi Catalin, After i install the JiraTestResultReporter.hpi file and reboot Jenkins will the snippet generator work?

          Hi Catalin,

          Your fix is working great i was able to use the plugin in my pipeline Job. Thanks for your help.

           

          Aashish Rajguru added a comment - Hi Catalin, Your fix is working great i was able to use the plugin in my pipeline Job. Thanks for your help.  

          manus added a comment -

          Thanks catalinluta and andreituicu for your work on this!

          I see there's a branch for the fix, but no pull request. Was there a problem, or can this be merged & released soon? Thanks again!

          manus added a comment - Thanks catalinluta and andreituicu for your work on this! I see there's a branch for the fix , but no pull request. Was there a problem, or can this be merged & released soon? Thanks again!

          kevin nielsen added a comment - - edited

          Hey, Caitlyn and Aashish Rajguru,  I'm trying to test out the workaround 

          I downloaded the git repo from https://github.com/jenkinsci/JiraTestResultReporter-plugin and I ran mvn hpi:hpi and it successfully created the hpi file, i then imported it into jenkins via jenkins plugin gui(located in advanced tab) and set up the JiraTest parameters in the settings

           

          Do you have an example of the code that works to run this plugin in a pipeline? I've tried the code below and it gets an unable to initialize object error

              <code>

          junit (
          testResults: '*/surefire-reports/.xml',
          testDataPublishers: [
          [$class: 'JiraTestDataPublisher',
          configs: [
          [$class: 'StringFields', fieldKey: 'Summary', value: 'Test Summary'],
          [$class: 'StringFields', fieldKey: 'Description', value: 'Test description.'],
          ],
          projectKey: 'NTS',
          issueType: '1',
          autoRaiseIssue: true,
          autoResolveIssue: false,
          autoUnlinkIssue: false,
          ],
          ])   

          </code>

          kevin nielsen added a comment - - edited Hey, Caitlyn and Aashish Rajguru,  I'm trying to test out the workaround  I downloaded the git repo from https://github.com/jenkinsci/JiraTestResultReporter-plugin  and I ran mvn hpi:hpi and it successfully created the hpi file, i then imported it into jenkins via jenkins plugin gui(located in advanced tab) and set up the JiraTest parameters in the settings   Do you have an example of the code that works to run this plugin in a pipeline? I've tried the code below and it gets an unable to initialize object error     <code> junit ( testResults: '* /surefire-reports/ .xml', testDataPublishers: [ [$class: 'JiraTestDataPublisher', configs: [ [$class: 'StringFields', fieldKey: 'Summary', value: 'Test Summary'] , [$class: 'StringFields', fieldKey: 'Description', value: 'Test description.'] , ], projectKey: 'NTS', issueType: '1', autoRaiseIssue: true, autoResolveIssue: false, autoUnlinkIssue: false, ], ])    </code>

          Delon Wong added a comment - - edited

          Hey catalinluta, I've too tested the fix https://github.com/jenkinsci/JiraTestResultReporter-plugin/tree/issue/JENKINS-51243 and it seems to work great! When could we see this get a PR merged? Thanks a lot.

          Delon Wong added a comment - - edited Hey catalinluta , I've too tested the fix https://github.com/jenkinsci/JiraTestResultReporter-plugin/tree/issue/JENKINS-51243  and it seems to work great! When could we see this get a PR merged? Thanks a lot.

          Hey knielse1 below is the code snippet that works for me.

          junit (
          testResults: '*/test-automation/config/.xml',
          testDataPublishers: [
          [$class: 'JiraTestDataPublisher',
          configs: [
          [$class: 'StringFields', fieldKey: 'Summary', value: 'Test Summary'],
          [$class: 'StringFields', fieldKey: 'Description', value: 'Test description.'],
          ],
          projectKey: 'CS',
          issueType: '10006', // "Bug" type
          autoRaiseIssue: false,
          autoResolveIssue: false,
          autoUnlinkIssue: false,
          ],
          ])

           

          Thanks

          Aashish Rajguru added a comment - Hey knielse1  below is the code snippet that works for me. junit ( testResults: '* /test-automation/config/ .xml', testDataPublishers: [ [$class: 'JiraTestDataPublisher', configs: [ [$class: 'StringFields', fieldKey: 'Summary', value: 'Test Summary'] , [$class: 'StringFields', fieldKey: 'Description', value: 'Test description.'] , ], projectKey: 'CS', issueType: '10006', // "Bug" type autoRaiseIssue: false, autoResolveIssue: false, autoUnlinkIssue: false, ], ])   Thanks

          Hi,

          I'm new to Jenkins. Can we also check that this works with [Job DSL](https://wiki.jenkins.io/display/JENKINS/Job+DSL+Plugin)? I believe functionality should be similar.

          Thanks.

          Mikhail Gryzykhin added a comment - Hi, I'm new to Jenkins. Can we also check that this works with [Job DSL] ( https://wiki.jenkins.io/display/JENKINS/Job+DSL+Plugin)? I believe functionality should be similar. Thanks.

          manus added a comment -

          Hello! I created a pull request based off the andreituicu's branch here:
          https://github.com/jenkinsci/JiraTestResultReporter-plugin/pull/13

          Please feel free to review, merge, and release when you see fit!
          (cc: catalinluta)

          manus added a comment - Hello! I created a pull request based off the andreituicu 's branch here: https://github.com/jenkinsci/JiraTestResultReporter-plugin/pull/13 Please feel free to review, merge, and release when you see fit! (cc: catalinluta )

          Christian added a comment -

          Christian added a comment - Available since JiraTestResultReporter-2.0.15

            catalinluta Catalin Luta
            aashish89 Aashish Rajguru
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: