Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Unable to update the JIRA ststus using the jenkins grrovy, below is the sample code for the same.

Unable to update the JIRA ststus using the jenkins grrovy, below is the sample code for the same.

Kiran Ghanate
April 17, 2020

jiraStatusUpdate(jiraTicketNumber)
jiraAddComment comment: 'Job executed successfully', idOrKey: jiraTicketNumber, site: 'PDT_JIRA'

 

public void jiraStatusUpdate(jiraTicketNumber){
def transitions = jiraGetIssueTransitions idOrKey: jiraTicketNumber, site: 'PDT_JIRA'
def idKey
System.out.println("In JIRA Update")
for(String key : transitions.data.transitions){
println "=====>" + key.name
if (key.name.equals("Failure")){
idKey = key.id
println idKey
}
if (key.name.equals("Success")){
idKey = key.id
println idKey
}
}
if(idKey != null){
def transitionInput =[transition: [id: idKey]]
println transitionInput

jiraTransitionIssue idOrKey: jiraTicketNumber, input: transitionInput, site: 'PDT_JIRA'
}

}

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events