Hi Touseef,
As excepted JIRA issue can be created in pipeline projects, using
Jenkinsfile (assuming you are known of Jenkinsfile [pipeline steps written
in groovy language]). Anyway we can use the following syntax (code Snippet)
to implement it :
//--------------------------------------------------------------------------------------------------
pipeline { agent any
stages { stage('build') { steps {
echo "build steps" } }
stage('testing') { steps { echo
"unit testing" } }
}
}
post { success { emailext ( to:
'[email protected]', mimeType: 'text/html',
subject: "*************** As excepted***********",
body: "************** As excepted **************" )
} failure { emailext ( to:
'[email protected]', mimeType: 'text/html',
subject: "*************** As excepted***********",
body: "************** As excepted **************" )
create_newjira_issue() }}
void create_newjira_issue() { node { stage('JIRA') {
def NewJiraIssue = [fields: [project: [key: 'PROJETC_NAME : can be
taken from JIRA website'], summary: 'Build Failed :
Summary.', description: 'Description of JIRA ticket ',
issuetype: [id: 'PROJECT ID : can get using JIRA API']]]
response = jiraNewIssue issue: NewJiraIssue, site: 'THAT CAN BE SET IN
JENKINS CONFIGURATION OR CAN DIRECTLY WRITE HERE' echo
response.successful.toString() echo response.data.toString() }
}}
//--------------------------------------------------------------------------------------------------
Note : To get the JIRA fields you should have admin access of JIRA
else get above information from JIRA admin.
Regards,
Anish Choudhary
On Mon, Nov 11, 2019 at 10:01 AM touseef <[email protected]> wrote:
> I want to Create Jira Issue on Build Failure through *Jenkins pipeline*.I
> am able to achive this help in freestyle projects.
> Can anyone help me in integrating the create jira issue in jira
> automatically via pipeline syntax when jenkins build fails.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/e3fbcd13-9e9d-4eab-b3b9-222e9864d6b6%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/e3fbcd13-9e9d-4eab-b3b9-222e9864d6b6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CAJaPuWwc2ty7nnSM4Bfd%3DWpSJxwPQ8e%2BOeJ7tyxR36Qdyy2xPQ%40mail.gmail.com.