Paresh
0
Q:

jira pipeline steps find jira id from comments

pipeline {
    stages {
        stage('jira') {
            steps {
                comment_issues()
            }
        }
    }
}

void comment_issues() {
    def issue_pattern = "TEST-\\d+"

    // Find all relevant commit ids
    currentBuild.changeSets.each {changeSet ->
        changeSet.each { commit ->
            String msg = commit.getMsg()
            msg.findAll(issue_pattern).each {
                // Actually post a comment
                id -> jiraAddComment idOrKey: id, comment: 'Hi there!'
            }
        }
    }
}
0

New to Communities?

Join the community