Skip to content

Commit 8abea1e

Browse files
Add jenkins admin user script to container (#384)
* Jenkins admin user is explicitly added through a script
1 parent a93b186 commit 8abea1e

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/main/docker/docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,10 @@ services:
135135
depends_on:
136136
- rabbitmq
137137
- mongodb
138+
volumes:
139+
- "./jenkins/security.groovy:/usr/share/jenkins/ref/init.groovy.d/security.groovy"
138140
environment:
139-
- JENKINS_USERNAME=admin
140-
- JENKINS_PASSWORD=admin
141-
# - JENKINS_HOME= # JENKINS_HOME: Jenkins home directory. Default: /opt/bitnami/jenkins/jenkins_home
142-
# - DISABLE_JENKINS_INITIALIZATION=yes # DISABLE_JENKINS_INITIALIZATION: Allows to disable the initial Bitnami configuration for Jenkins. Default: no
143-
# - JAVA_OPTS= # JAVA_OPTS: Customize JVM parameters. No defaults.
141+
- JAVA_OPTS="-Djenkins.install.runSetupWizard=false" # To make sure unlock screen and plug-in install is skipped on start up
144142
networks:
145143
eiffel_2.0_1:
146144
aliases:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!groovy
2+
// Add the user admin explicitly to jenkins
3+
// Strategy is set to give full access to logged in user
4+
5+
import jenkins.model.*
6+
import hudson.security.*
7+
8+
def instance = Jenkins.getInstance()
9+
10+
def hudsonRealm = new HudsonPrivateSecurityRealm(false)
11+
hudsonRealm.createAccount("admin", "admin")
12+
instance.setSecurityRealm(hudsonRealm)
13+
14+
def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
15+
instance.setAuthorizationStrategy(strategy)
16+
instance.save()

0 commit comments

Comments
 (0)