Apply Jenkins theme via init script

This commit is contained in:
Brad Stein 2025-12-18 10:41:37 -03:00
parent 5531ec045d
commit b7e4545734

View File

@ -170,6 +170,23 @@ spec:
println("Failed to configure OIDC realm: ${e}") println("Failed to configure OIDC realm: ${e}")
throw e throw e
} }
theme.groovy: |
import jenkins.model.Jenkins
import org.codefirst.SimpleThemeDecorator
def instance = Jenkins.get()
def decorators = instance.getExtensionList(SimpleThemeDecorator.class)
if (decorators?.size() > 0) {
def theme = decorators[0]
theme.setCssUrl("https://jenkins-contrib-themes.github.io/jenkins-material-theme/dist/material-ocean.css")
theme.setJsUrl("")
theme.setTheme("")
instance.save()
println("Applied simple-theme-plugin dark theme")
} else {
println("simple-theme-plugin not installed; skipping theme configuration")
}
JCasC: JCasC:
defaultConfig: false defaultConfig: false
securityRealm: "" securityRealm: ""
@ -244,10 +261,6 @@ spec:
creationOfLegacyTokenEnabled: false creationOfLegacyTokenEnabled: false
tokenGenerationOnCreationEnabled: false tokenGenerationOnCreationEnabled: false
usageStatisticsEnabled: true usageStatisticsEnabled: true
unclassified:
simple-theme-plugin:
elements:
- cssUrl: "https://jenkins-contrib-themes.github.io/jenkins-material-theme/dist/material-ocean.css"
creds.yaml: | creds.yaml: |
credentials: credentials:
system: system: