melston
melston

Reputation: 2340

Set Jenkins build name only on successful build

I am trying to set the build name of a Jenkins build only on a successful build. Any failure, whether in building or testing, should use the 'default' (build number) instead.

I can't find any mention of this in the documentation or online. Is this possible?

Upvotes: 0

Views: 678

Answers (2)

MaTePe
MaTePe

Reputation: 954

It is pretty simple to do with Groovy Postbuild: https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin

You have some nice examples there too. So just check result and then set the:

manager.build.result

As they do in Example 3

Upvotes: 1

Dvir669
Dvir669

Reputation: 8580

In the post build operation you can run a "set of scripts" - there you can select any way to do so, set a description, run system groovy or groovy script to change the name or any other method of your choosing - you can add many build steps to help you do so. wrap it around a conditional statement and run it only when build is successful.

Good luck!

Upvotes: 1

Related Questions