美文网首页
jenkins构建go报错Failed to install h

jenkins构建go报错Failed to install h

作者: 耍帅oldboy | 来源:发表于2022-10-01 11:47 被阅读0次

    使用jenkis自带go插件构建会报如下错误,原因是https://golang.org国外地址我们无法下载

    10:53:17  > git rev-list --no-walk d12fa1773cf369dacb3e69ac77e4c940fc1a36d7 # timeout=10
    10:53:37 FATAL: Failed to install https://golang.org/dl/go1.18.3.linux-amd64.tar.gz to /var/jenkins_home/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.18.3
    10:53:37 java.net.SocketTimeoutException: connect timed out
    10:53:37    at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
    10:53:37    at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
    10:53:37    at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
    10:53:37    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
    10:53:37    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    

    解决方案如下,地址全部替换成https://gomirrors.org

    vim /var/lib/jenkins/updates/org.jenkinsci.plugins.golang.GolangInstaller
    :s#https://golang.org/dl#https://gomirrors.org/dl/go#g
    

    构建脚本

    export GO111MODULE=on
    #使用代理下载依赖
    export GOPROXY=https://goproxy.cn
    go build -o server main.go
    

    相关文章

      网友评论

          本文标题:jenkins构建go报错Failed to install h

          本文链接:https://www.haomeiwen.com/subject/dghdartx.html