Home > other >  Set global description for Jenkins instance
Set global description for Jenkins instance

Time:04-21

Using Jenkins we would like to set this global description by default. We have used groovy scripts to set other global variables but I'm struggling to find what methods / classes I need to call in order to set this description for our Jenkins instance. I see many description plugins for builds but this is instead the description you see on the Jenkins homepage (not per build). In the image below I clicked "Edit description" and then typed "test" in the box and pressed save.

That's the workflow we'd like to automate using Jenkins groovy code :)

description block in jenkins

Thanks!

CodePudding user response:

The description that is shown in your image, is not a global Jenkins description but rather the description of the current view you are looking on - in this case the All view. If you switch to another view it will change.
To modify this via groovy code you need to modify the description of the view by its name:

Jenkins.instance.getView('all').setDescription("My New Description")

If you do want a global message that will appear always regardless of the selected view you can use the System Message option (configurable via the Configure System menu):

This message will be displayed at the top of the Jenkins main page.
This can be useful for posting notifications to your users

To update the system message via groovy code you can use the flowing:

Jenkins.instance.setSystemMessage("My System Message")
  • Related