Search code examples
linuxjenkinsjenkins-pluginsjenkins-pipelinejenkins-cli

How to set a string name for pipeline build in jenkins


I am running jenkins on a linux machine. I have a pipeline job in place, so each pipeline build shows build number in general. Instead of that is it possible to give string parameter to display on the UI ? I have tried checking build parameter plugin, but in pipeline configuration i don't see option to inject the string parameter. And the documentation doesn't help.


Solution

  • You can set the build name by doing:

    currentBuild.displayName = "#${currentBuild.number} Hello"
    

    This will name the build #2 Hello for build number 2.