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

JiraTestResultReporter-plugin - API testToIssueMapping doesn't work when Jenkins job exists in sub-folder

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins version 2.107.2
      JiraTestReporter plugin version 2.0.6

      When JiraTestResultReporter plugin API "testToIssueMapping" is called for the Jenkins job residing under a sub-folder, then it is throwing error. It is assuming that the folder is a matrix project and thus failing with below error:

      java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.Folder cannot be cast to hudson.matrix.MatrixProject
      {{ at org.jenkinsci.plugins.JiraTestResultReporter.api.TestToIssueMappingApi.doJson(TestToIssueMappingApi.java:49)}}

      Full stack trace and logs attached herewith.

      Steps to reproduce:

      1. Create a Jenkins job under some folder say "myfolder/test_job"
      2. Configure post build action with publish JUnit result report and add JiraTestResultReporter step with appropriate values
      3. Optional step, to run the job, let the test fail and tag the Jira ID against the failed test
      4. Call the API URL as "http://<jenkins_url>/plugin/JiraTestResultReporter/testToIssueMapping/api/json?job=myfolder/test_job"

      Expected

      At step 4, it should return the json with correct Jira mapping for the job

      Actual

      At step 4, it fails with error as mentioned above and in screenshot

       

      PS: I will be creating a fix for this through a PR and update the link in the comments. Thanks!

        1. jenkins-logs.txt
          8 kB
          Krupal Desai
        2. JiraTestResultReporter-API-defect.png
          336 kB
          Krupal Desai

            catalinluta Catalin Luta
            krupaldesai Krupal Desai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: