first commit

This commit is contained in:
yukumi.okada 2024-11-12 16:49:27 +09:00
commit b75dcc92cf
3 changed files with 137 additions and 0 deletions

80
compose.yml Normal file
View File

@ -0,0 +1,80 @@
services:
jenkins1:
image: jenkins/jenkins:lts
container_name: jenkins1
ports:
- "8081:8080"
volumes:
- jenkins_home1:/var/jenkins_home
- ./init.groovy.d:/var/jenkins_home/init.groovy.d
environment:
- JENKINS_USER=admin
- JENKINS_PASS=password
networks:
- jenkins_network
jenkins2:
image: jenkins/jenkins:lts
container_name: jenkins2
ports:
- "8082:8080"
volumes:
- jenkins_home2:/var/jenkins_home
- ./init.groovy.d:/var/jenkins_home/init.groovy.d
environment:
- JENKINS_USER=admin
- JENKINS_PASS=password
networks:
- jenkins_network
jenkins3:
image: jenkins/jenkins:lts
container_name: jenkins3
ports:
- "8083:8080"
volumes:
- jenkins_home3:/var/jenkins_home
- ./init.groovy.d:/var/jenkins_home/init.groovy.d
environment:
- JENKINS_USER=admin
- JENKINS_PASS=password
networks:
- jenkins_network
jenkins4:
image: jenkins/jenkins:lts
container_name: jenkins4
ports:
- "8084:8080"
volumes:
- jenkins_home4:/var/jenkins_home
- ./init.groovy.d:/var/jenkins_home/init.groovy.d
environment:
- JENKINS_USER=admin
- JENKINS_PASS=password
networks:
- jenkins_network
jenkins5:
image: jenkins/jenkins:lts
container_name: jenkins5
ports:
- "8085:8080"
volumes:
- jenkins_home5:/var/jenkins_home
- ./init.groovy.d:/var/jenkins_home/init.groovy.d
environment:
- JENKINS_USER=admin
- JENKINS_PASS=password
networks:
- jenkins_network
volumes:
jenkins_home1:
jenkins_home2:
jenkins_home3:
jenkins_home4:
jenkins_home5:
networks:
jenkins_network:

View File

@ -0,0 +1,20 @@
import jenkins.model.*
import hudson.security.*
def instance = Jenkins.getInstance()
//
def adminUsername = System.getenv("JENKINS_USER") ?: "admin"
def adminPassword = System.getenv("JENKINS_PASS") ?: "password"
//
def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount(adminUsername, adminPassword)
instance.setSecurityRealm(hudsonRealm)
//
def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
strategy.setAllowAnonymousRead(false)
instance.setAuthorizationStrategy(strategy)
instance.save()

View File

@ -0,0 +1,37 @@
import jenkins.model.*
import hudson.security.*
import jenkins.install.InstallState
def instance = Jenkins.getInstance()
//
def pluginManager = instance.getPluginManager()
def updateCenter = instance.getUpdateCenter()
updateCenter.updateAllSites()
//
def plugins = [
"git",
"workflow-aggregator",
"credentials-binding",
"docker-plugin",
"docker-workflow",
"blueocean",
"slack-notification",
"pipeline-stage-view",
"email-ext"
]
//
plugins.each {
if (!pluginManager.getPlugin(it)) {
def plugin = updateCenter.getPlugin(it)
if (plugin) {
plugin.deploy()
}
}
}
//
instance.setInstallState(InstallState.INITIAL_SETUP_COMPLETED)
instance.save()