first commit
This commit is contained in:
commit
b75dcc92cf
80
compose.yml
Normal file
80
compose.yml
Normal 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:
|
20
init.groovy.d/basic-security.groovy
Normal file
20
init.groovy.d/basic-security.groovy
Normal 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()
|
37
init.groovy.d/customize-jenkins.groovy
Normal file
37
init.groovy.d/customize-jenkins.groovy
Normal 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()
|
Loading…
Reference in New Issue
Block a user