-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented groovy script to configure admin user creation using envi…
…ronment variables passed to the vm
- Loading branch information
1 parent
fe9d810
commit 84a7992
Showing
4 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
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
11 changes: 0 additions & 11 deletions
11
tfgrid3/jenkins/rootfs/etc/zinit/print-jenkins-password.yaml
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
exec: /usr/bin/jenkins | ||
exec: /usr/bin/jenkins --httpPort=9090 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!groovy | ||
|
||
import jenkins.model.* | ||
import hudson.security.* | ||
|
||
def instance = Jenkins.getInstance() | ||
|
||
def adminUsername = System.getenv("JENKINS_ADMIN_USERNAME") ?: "admin" | ||
def adminPassword = System.getenv("JENKINS_ADMIN_PASSWORD") ?: "admin" | ||
|
||
def hudsonRealm = new HudsonPrivateSecurityRealm(false) | ||
hudsonRealm.createAccount(adminUsername, adminPassword) | ||
instance.setSecurityRealm(hudsonRealm) | ||
|
||
def strategy = new FullControlOnceLoggedInAuthorizationStrategy() | ||
instance.setAuthorizationStrategy(strategy) | ||
instance.save() |