[JIRA] (JENKINS-58180) How to retrieve JIRA task status using jira-steps-plugin

34 views
Skip to first unread message

kshettihewa@gmail.com (JIRA)

unread,
Jun 25, 2019, 4:26:01 AM6/25/19
to jenkinsc...@googlegroups.com
hhkkss created an issue
 
Jenkins / Task JENKINS-58180
How to retrieve JIRA task status using jira-steps-plugin
Issue Type: Task Task
Assignee: Naresh Rayapati
Components: jira-steps-plugin
Created: 2019-06-25 08:25
Priority: Minor Minor
Reporter: hhkkss

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.

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()
    }
}

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kshettihewa@gmail.com (JIRA)

unread,
Jun 25, 2019, 4:27:02 AM6/25/19
to jenkinsc...@googlegroups.com
hhkkss updated an issue
Change By: hhkkss
How I can get the status of a Jira task using [jira-steps-plugin. |https://issues.jenkins-ci.org/issues/?jql=project+%3D+JENKINS+AND+component+%3D+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:
{code:java}

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()
    }
}
{code}
 

 

kshettihewa@gmail.com (JIRA)

unread,
Jun 26, 2019, 12:11:02 AM6/26/19
to jenkinsc...@googlegroups.com

kshettihewa@gmail.com (JIRA)

unread,
Jun 26, 2019, 12:17:02 AM6/26/19
to jenkinsc...@googlegroups.com
hhkkss commented on Bug JENKINS-58180
 
Re: How to retrieve JIRA task status using jira-steps-plugin
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

naresh.rayapati@gmail.com (JIRA)

unread,
Jun 30, 2019, 9:43:02 AM6/30/19
to jenkinsc...@googlegroups.com

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.

naresh.rayapati@gmail.com (JIRA)

unread,
Aug 31, 2019, 8:11:02 PM8/31/19
to jenkinsc...@googlegroups.com

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

naresh.rayapati@gmail.com (JIRA)

unread,
Aug 31, 2019, 8:12:02 PM8/31/19
to jenkinsc...@googlegroups.com
Naresh Rayapati closed an issue as Not A Defect
 
Change By: Naresh Rayapati
Status: Open Closed
Resolution: Not A Defect
Reply all
Reply to author
Forward
0 new messages