1 Star 0 Fork 21

梦在前方路在脚下 / docker-zh

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cwp-init.groovy 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
Rick 提交于 2020-02-22 22:21 . Add casc for the update-center config
import hudson.Plugin;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import hudson.init.InitMilestone;
import jenkins.model.Jenkins;
Thread.start {
while(true) {
Jenkins instance = Jenkins.getInstance();
InitMilestone initLevel = instance.getInitLevel();
Thread.sleep(1500L);
println "Jenkins not ready when handle init config..."
if (initLevel >= InitMilestone.PLUGINS_STARTED) {
Plugin zhPlugin = instance.getPlugin("localization-zh-cn");
if (zhPlugin != null) {
InputStream input = zhPlugin.getWrapper().classLoader.getResourceAsStream("mirror-adapter.crt");
if (input == null) {
System.err.println("cannot found mirror-adapter.crt from localization-zh-cn, would not copy cert file");
break;
}
File certPath = new File(instance.getRootDir(), "/war/WEB-INF/update-center-rootCAs/mirror-adapter.crt");
FileOutputStream out = new FileOutputStream(certPath);
byte[] buf = new byte[1024];
int count = -1;
while((count = input.read(buf)) > 0) {
out.write(buf, 0, count);
}
println "Jenkins init ready..."
} else {
System.err.println("cannot found localization-zh-cn, would not copy cert file");
}
break
}
}
println "cert init thread done"
}
Java
1
https://gitee.com/mzqflzjx/docker-zh.git
git@gitee.com:mzqflzjx/docker-zh.git
mzqflzjx
docker-zh
docker-zh
master

搜索帮助