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

How to retrieve JIRA task status using jira-steps-plugin

    XMLWordPrintable

Details

    Description

      How I can get the status of a Jira task using jira-steps-plugin. 

      I have created a Jira task from Jenkins pipeline script and latter I want to retrieve the status of that task to continue further steps in my pipeline. 

      For example, when the task is updated as DONE, I need to trigger the deployment stage in my pipeline.

       

      This is what I used to create the task:

      node {
        stage('JIRA') {
          def testIssue = [fields: [ project: [key: 'PROJECT'],
                                       summary: 'New JIRA Created from Jenkins -       Summery.',
                                       description: 'New JIRA Created from Jenkins - Description.',
                                       issuetype: [name: 'Task']]]      response = jiraNewIssue issue: testIssue, site: 'JIRA'      echo response.successful.toString()
            echo response.data.toString()
          }
      }
      

       

       

      Attachments

        Activity

          hhkkss hhkkss added a comment -
          response = jiraGetIssue idOrKey: 'DEV-21'
          def statusResponse =  response.data.fields.status.toString()
          echo statusResponse
          
          
          
          
          
          

          This is respond below output:
          [self:http://x.x.x.x:8090/rest/api/2/status/10000, description:, iconUrl:http://x.x.x.x:8090/, name:To Do, id:10000, statusCategory:self:[http://x.x.x.x:8090/rest/api/2/statuscategory/2]
           

          Wondering why status field not gives just the Jira issue status

          hhkkss hhkkss added a comment - response = jiraGetIssue idOrKey: 'DEV-21' def statusResponse = response.data.fields.status.toString() echo statusResponse This is respond below output: [self: http://x.x.x.x:8090/rest/api/2/status/10000 , description:, iconUrl: http://x.x.x.x:8090/ , name:To Do, id:10000, statusCategory: self:[http://x.x.x.x:8090/rest/api/2/statuscategory/2 ]   Wondering why status field not gives just the Jira issue status

          This plugin is just a wrapper on top of the JIRA REST API. So it just returns what that API returns. The response is the status object with the name To Do.

          nrayapati Naresh Rayapati added a comment - This plugin is just a wrapper on top of the JIRA REST API. So it just returns what that API returns. The response is the status object with the name To Do.

          Reopen or log another Jira if this is still an issue. 

          nrayapati Naresh Rayapati added a comment - Reopen or log another Jira if this is still an issue. 

          People

            nrayapati Naresh Rayapati
            hhkkss hhkkss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: