0

I'm new users of Jenkins, I would like to add in the stage UI, some informations on each build as git branch, and the user who lunched the build. any ideas please ? I thought of adding a new stage in the pipeline script but did not know how to print the UI view. enter image description here

MrsIl
  • 53
  • 1
  • 5

2 Answers2

0

You can retrieve the branch name via env.BRANCH_NAME, however, it seems that retrieving the user who kicked off the build is a little more complicated, see here https://stackoverflow.com/a/36545353/616436

With regards displaying the information, you can use currentBuild.description = "Build info here..." to display a message in the Build History of Jenkins e.g.

enter image description here

Will
  • 310
  • 2
  • 4
  • 10
0

When you call a stage step with the stage () call, you can give as input value the name of the stage. For example, you can do stage ('my own name') or stage ('another different name'). Just notice a few things:

  • As input, you can use variables. I have not tested, but I assume these variables should be "global" to be used. You can modify the variable adding what you need and then, use it in the stage () call
  • If you change the stage name between builds, jenkins job will show just the stages of the last build, not the previous ones because you have "different" stages!
  • There are other solutions, like adding that information you want into the build description/title or using plugins like the "Rich Text Publisher"
Jose Camacho
  • 281
  • 2
  • 8