How to pass JIRA current issue key in Jenkins pipeline script.

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 1, 2022

Hi Team,

We have to send Jenkins build status to JIRA ticket for currently selected JIRA ticket. We have to pass JIRA current issue key in Jenkins pipeline script. Currently its working for hard coded JIRA issue value(Ex: LPPAD-124) and its working absolutly fine. Now I need to pass the JIRA current ticket / issue nu,ber to the pipeline script. 

 

This Jenkinks, build is set up to trigger form JIRA, it is also working fien, Now need to fecth each Jira triggering get the current build status on the JIRA ticket. 

 

Script: 

    post {

        always {

           

            jiraAddComment comment: "Job \'${JOB_NAME}\' build number (${BUILD_NUMBER}) is done and build status is ${currentBuild.currentResult} ,Please go to ${BUILD_URL}console and verify the build", idOrKey: 'LPPAD-124', site: 'jira_integration'

 

Here, instead of 'LPPAD-124', I need to pass the dynamic , current JIRA ticket value.  Please help me to fix  this. 

 

 

 

Thank you,

Dev G

 

 

 

2 answers

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2022

Where are you writing and running this script?

Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2022

Hi @Nic Brough -Adaptavist- ,

In Jenkins pipeline, I am writting this script. Its a shell script.

 

 

 

 

Thank you.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2022

Ok, so how is it being triggered?

0 votes
Devendar Gangapuram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2022

 

 

Hi Team,

Please repsond on this, its blocking our deliverables. 

 

 

Thanks in advance,

Dev G

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events