0
votes

In our Jenkins pipeline, we are currently publishing build artifacts when commits are made to specific branches.

The Jenkinsfile currently has something like this:

stage("Publish to Docker Registry") {
    when { anyOf { branch "release"; branch "prerelease" } }
    ...
}

We would like to change this to executing on any tagged commit, but I cannot find anything about using tags as a trigger in the documentation:

https://jenkins.io/doc/book/pipeline/syntax/#when

Is this possible?

We are using git.

1

1 Answers

0
votes

You dont need to look from the jenkins side. You need to look for information about webhook using git comments.

For example in my company we have a webhook in gitlab that push every comment to jenkins but jenkins only build the ones that say "jenkins please build" enter image description here

And then you need to configure in jenkins like a build trigger enter image description here