Spring Monkey
Spring Monkey

Reputation: 5178

Jenkins Pipeline builds self checkins

I have a simple build release pipeline setup for a maven project:

checkout scm
sh 'mvn -B release:prepare release:perform'

The jenkins SCM polling is enabled. When release is done, an scm commit is made with the next version in the pom.xml file.

Because of the polling, the jenkins builds start again.

How do I disable this?

Upvotes: 1

Views: 89

Answers (1)

Krzysztof Krasoń
Krzysztof Krasoń

Reputation: 27476

It would have to be done in the Jenkinsfile using check for e.g. last commit message:

checkout scm
sh `git log --format=%s -1 > last-message`
lastMessage = readFile('last-message').trim()
if (lastMessage.startsWith('[maven-release-plugin]') {
    return
}

Upvotes: 1

Related Questions