Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Best practice-Jenkins slow solution to offline and plug-in installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In deploying jenkins, whether it is k8s to deploy jenkins or traditional to deploy jenkins, there will be two problems: one is slow download plug-in, the other is offline, we need to do some optimization.

The first problem is that installing jenkins generally encounters offline jenkins. At present, most of this problem is due to a lot of problems accessing foreign servers, but some will not affect them, and even run normally. However, some will appear offline, so we still need some ways to deal with this problem.

At present, to solve this problem, whether it is k8s or traditional deployment, these configurations must be modified in the working directory

Change this https to http

That is, the default working directory. This directory depends on where you personally put jenkins when deploying it. If it is not set, it is in the file/root/.jenkins/hudson.model. UpdateCenter.xml.

Because this is deployed in k8s, so here to change the persistent directory, but it is the same

[root@k8s-node3 kubernetes]# cd default-jenkins-home-pvc-c6e2ac7d-c2fc-4b8c-87c4-d73ea176049e/[root@k8s-node3 default-jenkins-home-pvc-c6e2ac7d-c2fc-4b8c-87c4-d73ea176049e]# cat hudson.model.UpdateCenter.xml default http://updates.jenkins.io/update-center.json

Like here need to restart, I directly delete pod, this default k8s will automatically help you start another, data will not be lost, because the use of persistence

Check whether it is normal, the test has been able to download plug-ins

The second problem is to install plug-ins, jenkins server is in foreign countries, so some will lead to slow download plug-ins, so you need to change the address of jenkins plug-ins to domestic access address

This is a k8s deployment, so the persistent working directory of this directory is placed here. If it is traditional, the default working directory is not modified at/root/.jenkins/updates/default.json.

If you modify it, um, replace the foreign address according to your own work directory.

[root@k8s-node3 ~]# cd /ifi/kubernetes/

Go to the persistent directory and go to default.

[root@k8s-node3 kubernetes]# cd default-jenkins-home-pvc-9d58c2b2-e325-4fae-a83a-808f3d5175ef/updates[root@k8s-node3 updates]# cat default.json

This directory is to modify, the default will see is to go to the google address, download plug-in is also the address of update, so download will be slow, of course, this plug-in generally into the web page to see the files under the updates, the default download will load this address, so you need to replace the configuration inside Tsinghua source, and before the page to replace, many do not take effect, so the final solution is to replace here json, In addition, restart in the jenkins directory to make it effective, or the traditional form of deploying war is to restart the war package.

Replacement, here because many foreign needs to replace all domestic sed

[root@k8s-node3 updates]# sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && \sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json

There is no problem installing plugins now

Now to test the speed of installing plug-ins is also carried

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report