Updating Jira tickets from a Jenkins workflow (jenkinsfile)

How can I update jira problem from Jenkinsfile (jenkins-worflow / pipe) ? Is there a way to use the Jira Issue Updater plugin as a step in a Jenkins file?

I know that I can use Jira RestAPI, but I'm trying to figure out if I can reuse the functionality of jira-updater- to issue .

What I'm looking for is something similar to the example below, calling Junit archiver and atifact archiver, but calling jira updater.

    node {
      git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
      def mvnHome = tool 'M3'
      sh "${mvnHome}/bin/mvn -B -Dmaven.test.failure.ignore verify"
      step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true])
      step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
    }
+4
source share
3 answers

Jira Plugin Pipeline.

:

step([$class: 'hudson.plugins.jira.JiraIssueUpdater', 
    issueSelector: [$class: 'hudson.plugins.jira.selector.DefaultIssueSelector'], 
    scm: [$class: 'GitSCM', branches: [[name: '*/master']], 
        userRemoteConfigs: [[url: 'https://github.com/jglick/simple-maven-project-with-tests.git']]]]) 

.

+5

JIRA Steps update Jira Ticket:

node {
  stage('JIRA') {
    # Look at IssueInput class for more information.
    def testIssue = [fields: [ // id or key must present for project.
                               project: [id: '10000'],
                               summary: 'New JIRA Created from Jenkins.',
                               description: 'New JIRA Created from Jenkins.',
                               customfield_1000: 'customValue',
                               // id or name must present for issuetype.
                               issuetype: [id: '3']]]

    response = jiraEditIssue idOrKey: 'TEST-01', issue: testIssue

    echo response.successful.toString()
    echo response.data.toString()
  }
}

Jenkinsfile , ...

0

Source: https://habr.com/ru/post/1627365/


All Articles