Created
May 21, 2018 14:24
-
-
Save ivan-pinatti/4c546abbf98bb91d1af3c773adb195ce to your computer and use it in GitHub Desktop.
Jenkins - Set Jenkins system message via groovy script - #jenkins #groovy #system #message
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 = "Insert your Jenkins system message here." | |
// get Jenkins instance | |
Jenkins jenkins = Jenkins.getInstance() | |
// set Jenkins system message | |
jenkins.setSystemMessage(systemMessage) | |
// save current Jenkins state to disk | |
jenkins.save() |
Hi @RakeshNagarajan,
I don't think it is possible to revert, however, you can add a version of this script on your Post-Initialization Jenkins folder, which will change the system message when the Jenkins is started again.
Please check this link; https://wiki.jenkins.io/display/JENKINS/Post-initialization+script.
Thanks for your scrip. Is there any possible way like, the system message should revert back after restart of jenkins.
I am planning to set the outage message in the jenkins, after restart the message need to vanish.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your scrip. Is there any possible way like, the system message should revert back after restart of jenkins.
I am planning to set the outage message in the jenkins, after restart the message need to vanish.