pipeline {
agent any
stages {
stage('build') {
steps {
echo "build steps"
}
}
stage('testing') {
steps {
echo "unit testing"
}
}
}
}
post {
success {
emailext (
to: 'bangarw...@gmail.com',
mimeType: 'text/html',
subject: "*************** As excepted***********",
body: "************** As excepted **************"
)
}
failure {
emailext (
to: 'bangarw...@gmail.com',
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.
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e3fbcd13-9e9d-4eab-b3b9-222e9864d6b6%40googlegroups.com.
Error when executing always post condition: java.lang.NoSuchMethodError: No such DSL method 'jiraNewIssue' found among steps
i am new bee.I tried debugging but could not trace back
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: 'bangar...@gmail.com',
mimeType: 'text/html', subject: "*************** As excepted***********", body: "************** As excepted **************" ) } failure { emailext (
to: 'bangar...@gmail.com',
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 <tousee...@gmail.com> 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 jenkins...@googlegroups.com.
Error when executing always post condition: java.lang.NoSuchMethodError: No such DSL method 'jiraNewIssue' found among steps
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/54397b05-f2b0-415a-8b02-34a996425c84%40googlegroups.com.