commit
afc560d715
3 changed files with 38 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||||||
|
version: '3.8' |
||||||
|
|
||||||
|
services: |
||||||
|
jenkins: |
||||||
|
image: jenkins/jenkins:lts |
||||||
|
container_name: jenkins |
||||||
|
ports: |
||||||
|
- "8181:8080" |
||||||
|
- "50000:50000" |
||||||
|
volumes: |
||||||
|
- jenkins_home:/var/jenkins_home |
||||||
|
- ./init.groovy.d:/var/jenkins_home/init.groovy.d |
||||||
|
environment: |
||||||
|
- JAVA_OPTS=-Djenkins.install.runSetupWizard=false |
||||||
|
restart: always |
||||||
|
|
||||||
|
volumes: |
||||||
|
jenkins_home: |
@ -0,0 +1,20 @@ |
|||||||
|
#!groovy |
||||||
|
|
||||||
|
import jenkins.model.* |
||||||
|
import hudson.security.* |
||||||
|
|
||||||
|
def instance = Jenkins.getInstance() |
||||||
|
|
||||||
|
println "--> creating local user 'admin'" |
||||||
|
|
||||||
|
// Create a default admin user |
||||||
|
def hudsonRealm = new HudsonPrivateSecurityRealm(false) |
||||||
|
hudsonRealm.createAccount('admin', 'A@1qaz2wsxA@') |
||||||
|
instance.setSecurityRealm(hudsonRealm) |
||||||
|
|
||||||
|
// Define global security settings |
||||||
|
def strategy = new FullControlOnceLoggedInAuthorizationStrategy() |
||||||
|
strategy.setAllowAnonymousRead(false) |
||||||
|
instance.setAuthorizationStrategy(strategy) |
||||||
|
|
||||||
|
instance.save() |
Loading…
Reference in new issue