Created
May 7, 2020 03:45
-
-
Save dkhode/40a7d7452469788bf1bcfb1a7273975d to your computer and use it in GitHub Desktop.
Jenkins - Set Jenkins system message via groovy script - #jenkins #groovy #system #message #html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
// imports | |
import jenkins.model.Jenkins | |
// parameters | |
def systemMessage = ''' | |
<h1><span style="background-color: #ff0000">Scheduled maintanence: Jenkins won't be available for use tonight @7pm CST</span></h1> | |
''' | |
// get Jenkins instance | |
Jenkins jenkins = Jenkins.getInstance() | |
// set Jenkins system message | |
jenkins.setSystemMessage(systemMessage) | |
// save current Jenkins state to disk | |
jenkins.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like this:
