Created
January 25, 2018 10:25
-
-
Save cccaternberg/fc6ab5582ff54cb49df9ae9b400e9756 to your computer and use it in GitHub Desktop.
Jira_Jenkinsfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
stage('Jira-Create-Task') { | |
withEnv(['JIRA_SITE=local']) { | |
def testIssue = [fields: [ project: [key: 'AUG2'], | |
summary: 'New JIRA Created from Jenkins.', | |
description: 'New JIRA Created from Jenkins.', | |
issuetype: [name: 'Task']]] | |
response = jiraNewIssue issue: testIssue | |
echo response.successful.toString() | |
echo response.data.toString() | |
} | |
} | |
stage('Jira-Add-Comment') { | |
try { | |
error "Exception" | |
} catch(error) { | |
def comment = "${BUILD_URL} FAILED" | |
jiraAddComment idOrKey: 'AUG-2', comment: comment,failOnError: false, site: 'local' | |
// currentBuild.result = 'FAILURE' | |
} | |
} | |
stage('Jira-Get-Comment') { | |
def comments = jiraGetComments idOrKey: 'AUG-2', site: 'local' | |
echo comments.data.toString() | |
} | |
stage('Jira-EditIssue') { | |
withEnv(['JIRA_SITE=LOCAL']) { | |
def testIssue = [fields: [ project: [key: 'AUG2'], | |
summary: 'New JIRA Created from Jenkins.', | |
description: 'New JIRA Created from Jenkins.', | |
issuetype: [name: 'Task']]] | |
response = jiraEditIssue idOrKey: 'AUG-2', issue: testIssue | |
echo response.successful.toString() | |
echo response.data.toString() | |
} | |
} | |
stage('Jira-GetIssue') { | |
withEnv(['JIRA_SITE=local']) { | |
def issue = jiraGetIssue idOrKey: 'AUG-1' | |
echo issue.data.toString() | |
} | |
} | |
stage('Jira-GetIssueFields') { | |
withEnv(['JIRA_SITE=local']) { | |
def fields = jiraGetFields idOrKey: 'AUG-2' | |
echo fields.data.toString() | |
} | |
} | |
stage('Jira-GetIssueTransitions') { | |
withEnv(['JIRA_SITE=local']) { | |
def transitions = jiraGetIssueTransitions idOrKey: 'AUG-2' | |
echo transitions.data.toString() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment