jenkins-插件更新加速

方法一:替换配置文件的URL

替换 .jenkins/updates/default.json中的URL
需要
http://updates.jenkins-ci.org/download/ 替换为 https://mirrors.tuna.tsinghua.edu.cn/jenkins/
http://www.google.com/ 替换为 https://www.baidu.com/

替换方式 1
cd {你的Jenkins工作目录}/updates
vim default.json
:1,$s/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g
:1,$s/http:\/\/www.google.com/https:\/\/www.baidu.com/g

替换方式 2
cd {你的Jenkins工作目录}/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

方法二:使用代理

step 1- 使用nginx自定义代理插件(清华镜像)

nginx 下载
http://nginx.org/download/nginx-1.18.0.tar.gz
http://nginx.org/download/nginx-1.18.0.zip

nginx配置文件(conf/nginx.conf)如下:

server
    {
        listen 80;
        server_name mirrors.jenkins-ci.org;
        location / {
            proxy_redirect off;
            proxy_pass https://mirrors.tuna.tsinghua.edu.cn/jenkins/;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Accept-Encoding "";
            proxy_set_header Accept-Language "zh-CN";
        }
        index index.html index.htm index.php;
        #error_page   404   /404.html;
        location ~ /\.
        {
            deny all;
        }

        access_log  /var/log/nginx/jenkins_proxy.access.log main;
        error_log   /var/log/nginx//jenkins_proxy.error.log;
    }
step 2-修改host文件
127.0.0.1 mirrors.jenkins-ci.org

windows : C:\Windows\System32\drivers\etc\hosts
linux : /etc/hosts

方法三(不推荐,好像不好用)

管理插件页面配置如下:
在这里插入图片描述

这个 URL 改成
http://mirror.xmission.com/jenkins/updates/update-center.json


https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值