Created
August 18, 2020 10:24
-
-
Save jonbrohauge/4e9433759e1596fe7962087e17f888ab to your computer and use it in GitHub Desktop.
How to set JenkinsURL on boot of Jenkins instance
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
import jenkins.model.* | |
jlc = JenkinsLocationConfiguration.get() | |
String virtualHost = System.getenv("VIRTUAL_HOST") | |
virtualHost = virtualHost.toLowerCase() | |
if (!virtualHost?.trim()) { | |
virtualHost = "[PLACE DEFAULT HOST HERE]" | |
} | |
jlc.setUrl("https://${virtualHost.toLowerCase()}/") | |
jlc.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment