使用國內鏡像加速你的jenkins


老鐵們,是不是每次安裝 jenkins 的時候,下載插件都能等上半天一天的。還在為此煩惱么,看過此篇文章立即解決你的煩惱。

國內已經有幾家站點都同步了 jenkins 倉庫和插件倉庫,當你設置了清華大學的 update-center.json 時,在滿懷欣喜的等待飆升的下載速度,得到的確實一動不動的進度條,那是因為國內鏡像源是原封不動的同步 jenkins倉庫的,其 update-center.json 里的插件下載地址還是 jenkins 的地址,當然加速不了。需要把這個文件里的下載路徑更改為國內鏡像源地址,才能享受飆升的下載速度。

為此,我針對國內的鏡像站點一一生成了 update-center.json 下面就教大家怎么使用吧!

測試速度

在使用國內鏡像站點的時候,不妨先測試下哪個站點下載速度最快的,我們當然要選擇最靚的那個崽了。

鏡像站點

  • tencent https://mirrors.cloud.tencent.com/jenkins/
  • huawei https://mirrors.huaweicloud.com/jenkins/
  • tsinghua https://mirrors.tuna.tsinghua.edu.cn/jenkins/
  • ustc https://mirrors.ustc.edu.cn/jenkins/
  • bit http://mirror.bit.edu.cn/jenkins/
# curl -sSL https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/speed-test.sh | bash Jenkins mirror update center speed test [Mirror Site] tencent : https://mirrors.cloud.tencent.com/jenkins/ bit : http://mirror.bit.edu.cn/jenkins/ huawei : https://mirrors.huaweicloud.com/jenkins/ tsinghua : https://mirrors.tuna.tsinghua.edu.cn/jenkins/ ustc : https://mirrors.ustc.edu.cn/jenkins/ [Test] Test File : updates/current/plugin-versions.json Site Name IPv4 address File Size Download Time Download Speed tencent 111.231.36.190 9.2M 2.6s 3.58MB/s bit 202.204.80.77 9.2M 6.6s 1.39MB/s huawei 117.78.24.32 9.2M 0.5s 19.4MB/s tsinghua 101.6.8.193 9.2M 9.6s 976KB/s ustc 202.38.95.110 9.2M 1.2s 7.75MB/s 

huawei 就是那個最靚的崽

使用國內鏡像

當我們在安裝完 jenkins 的時候,別着急登錄web,先使用下國內源

  1. 先上傳自定義的ca證書

    因為 update-center.json 需要證書簽名,jenkins會去校驗里面的數據。

[ ! -d /var/lib/jenkins/update-center-rootCAs ] && mkdir /var/lib/jenkins/update-center-rootCAs wget https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/rootCA/update-center.crt -O /var/lib/jenkins/update-center-rootCAs/update-center.crt chown jenkins.jenkins -R /var/lib/jenkins/update-center-rootCAs 
  1. 更改url

這里在終端里進行更改

sed -i 's#https://updates.jenkins.io/update-center.json#https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/huawei/update-center.json#' /var/lib/jenkins/hudson.model.UpdateCenter.xml 

當然也可以通過web 來更改:Go to Jenkins → Manage Jenkins → Manage Plugins → Advanced → Update Site and submit URL to your https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/huawei/update-center.json

然后再去 web 頁面初始化你的 jenkins,享受速度飆升的快感吧。

其他鏡像站點的 update-center.json

文件會在每天utc時間1點鍾更新

Site Source CDN
tencent https://raw.githubusercontent.com/lework/jenkins-update-center/master/updates/tencent/update-center.json https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/tencent/update-center.json
huawei https://raw.githubusercontent.com/lework/jenkins-update-center/master/updates/huawei/update-center.json https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/huawei/update-center.json
tsinghua https://raw.githubusercontent.com/lework/jenkins-update-center/master/updates/tsinghua/update-center.json https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/tsinghua/update-center.json
ustc https://raw.githubusercontent.com/lework/jenkins-update-center/master/updates/ustc/update-center.json https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/ustc/update-center.json
bit https://raw.githubusercontent.com/lework/jenkins-update-center/master/updates/bit/update-center.json https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/bit/update-center.json

原文地址 https://lework.github.io/2020/03/05/jenkins-update-center/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM