LoginSignup
1
1

More than 3 years have passed since last update.

Jenkinsのgolang crawler問題。

Last updated at Posted at 2020-07-02

Jenkinsで昨日になって急に起き始めたMalformedURLException

java.net.MalformedURLException: no protocol: /dl/go1.14.2.linux-amd64.tar.gz
    at java.net.URL.<init>(URL.java:593)
    at java.net.URL.<init>(URL.java:490)
    at java.net.URL.<init>(URL.java:439)
    at org.jenkinsci.plugins.golang.GolangInstaller.performInstallation(GolangInstaller.java:57)
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:72)
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
    at org.jenkinsci.plugins.golang.GolangInstallation.forNode(GolangInstallation.java:44)
    at org.jenkinsci.plugins.golang.GolangInstallation.forNode(GolangInstallation.java:22)
    at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
    at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
    at hudson.security.ACL.impersonate(ACL.java:260)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

なんだこりゃと思って、色々試してもあんまり変わらない。
今日になってネットで調べてみると以下の記事が見つかった。
https://qiita.com/cpp0302/items/27c1747bc3f9d753eb64

これそのものズバリだったので、対処も同様に行った。
これ大本は↓に書いてあるように、golangの仕様変更に伴って、jenkinsのcrawlerが対応できていなかったことなんだよね。

https://github.com/jenkins-infra/crawler/pull/89
https://github.com/golang/website/commit/58a31798e86f7e67791de8767e8353f734576199#diff-8dfde61e35bbbe9e94ea52fe96273aa9L280-R280

このcrawlerが変わると、一体どういう感じで反映されるんだろう…。自動ダウンロードがどういう仕組みになっているのかいまいちわからん。

In Manage Jenkins > Global Tool Configuration, you can edit your Go installation(s) to replace the "Install from golang.org" installer with the "Install from .tar.gz" installer, then provide the appropriate download URL, and the subdirectory (probably "go")

ワークアラウンドとして上記を採用したけど日本語版だと、Top→左ペインのJenkinsの管理Global Tool Configurationgoの欄ですね。
いやーこの辺最近触ってなかったので完全に見失った(笑)

また、設定する場合、DLしたディレクトリの直下ですね。(新規構築でもない限り普通はあるはず。)
つまり、
${JENKINS_HOME}/tools/org.jenkinsci.plugins.golang.GolangInstallation/(Jenkinsに設定されている名前)
これで良いはず。

補足

私は、${JENKINS_HOME}/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.14配下にインストール済みだったんだけど、

[jenkins]$ ls -ltr
合計 204
-rw-r--r--  1 jenkins jenkins   397  4月  9 04:15 SECURITY.md
-rw-r--r--  1 jenkins jenkins  1607  4月  9 04:15 README.md
-rw-r--r--  1 jenkins jenkins  1303  4月  9 04:15 PATENTS
-rw-r--r--  1 jenkins jenkins  1479  4月  9 04:15 LICENSE
-rw-r--r--  1 jenkins jenkins 90098  4月  9 04:15 CONTRIBUTORS
-rw-r--r--  1 jenkins jenkins  1339  4月  9 04:15 CONTRIBUTING.md
-rw-r--r--  1 jenkins jenkins 55383  4月  9 04:15 AUTHORS
-rw-r--r--  1 jenkins jenkins    26  4月  9 04:15 robots.txt
-rw-r--r--  1 jenkins jenkins  5686  4月  9 04:15 favicon.ico
-rw-r--r--  1 jenkins jenkins     8  4月  9 04:15 VERSION
drwxrwxr-x  2 jenkins jenkins   312  4月 30 18:05 api
drwxrwxr-x  2 jenkins jenkins    29  4月 30 18:05 bin
drwxrwxr-x  3 jenkins jenkins    18  4月 30 18:05 lib
drwxrwxr-x  7 jenkins jenkins  4096  4月 30 18:05 doc
drwxrwxr-x 12 jenkins jenkins   165  4月 30 18:05 misc
drwxrwxr-x  6 jenkins jenkins    76  4月 30 18:05 pkg
drwxrwxr-x 47 jenkins jenkins  4096  4月 30 18:05 src
drwxrwxr-x 23 jenkins jenkins 12288  4月 30 18:05 test

goのバイナリがあるのは、bin配下だから、最初
${JENKINS_HOME}/tools/org.jenkinsci.plugins.golang.GolangInstallation/1.14/binと設定したら、以下のようにエラーが出た。

[xxxx-THAL7GIC7EP2KG363RGLDNNRHS6T5VIFM7P5FDFXNXB5U4DDPX3Q] Running shell script
+ go env -w CGO_ENABLED=0
/jenkins_home/workspace/xxx-THAL7GIC7EP2KG363RGLDNNRHS6T5VIFM7P5FDFXNXB5U4DDPX3Q@tmp/durable-27fdf3a0/script.sh: 行 2: go: コマンドが見つかりません

補足2

起きるbranchと起きないbranchがある。
crawlする条件があるんだろうけど、そこまで調査していない。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1