jenkins修改清华镜像源失效的问题
先说结论:不要用清华的镜像,不要用清华的镜像,不要用清华的镜像,重要的事情说三次!那用什么呢?华为的亲测可用:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
再说现象:网上一大堆的教程让修改 hudson.model.UpdateCenter.xml ,把 http://updates.jenkins.io/update-center.json 改成 https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins。
实际上jenkins一启动,生成的default.json中的配置使用的是jenkins官网的地址,这是因为清华源指向的 update-center.json ,使用的也是jenkins官网的地址。于是又有人说default.json也修改, sed 命令批量替换。
sudo sed -i 's#updates.jenkins.io/download/plugins#mirrors.tuna.tsinghua.edu.cn/jenkins/plugins#g' default.json && sudo sed -i 's#www.google.com#www.baidu.com#g' default.json
实际上Jenkins一重启,default.json中的配置又变成官网的地址。
所以用华为的镜像源,只要在 hudson.model.UpdateCenter.xml 中替换url就好了。