ps.jenkins.1.0.2.source-code.admin-user-cm.yml Maven / Gradle / Ivy
metadata:
name: admin-user
data:
test.admin.password: ${TEST_ADMIN_PASSWORD}
basic-security.groovy: |-
#!groovy
import jenkins.model.*
import hudson.security.*
def instance = Jenkins.getInstance()
println "--> creating local user 'admin'"
def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount('admin',System.getenv("TEST_ADMIN_PASSWORD"))
instance.setSecurityRealm(hudsonRealm)
def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
instance.setAuthorizationStrategy(strategy)
instance.save()