読者です 読者をやめる 読者になる 読者になる

JenkinsでSubModuleの更新に失敗する

経緯

複数のリポジトリから参照されるスタイル設定情報をSubModule化しました。
ローカルでは問題なかったのですが、Jenkinsでエラーが発生するようになります。

対応

Jenkinsのジョブのソースコード管理>GitからAdvanced sub-modules behavioursを追加します。
Recursively update submodulesをチェックするとサブモジュールも更新されるらしい。
が、それでもエラーが出ます・・・

00:00:12.424  > git remote # timeout=10
00:00:12.426  > git submodule init # timeout=10
00:00:12.445  > git submodule sync # timeout=10
00:00:12.464  > git config --get remote.origin.url # timeout=10
00:00:12.469  > git submodule update --init --recursive
00:00:12.543 FATAL: Command "git submodule update --init --recursive" returned status code 1:
00:00:12.543 stdout: 
00:00:12.543 stderr: Cloning into 'submodule_lib'...
00:00:12.543 fatal: Authentication failed for 'http://git.example.com/scm/projects/submodule_lib.git/'
00:00:12.543 Clone of 'http://git.example.com/scm/projects/submodule_lib.git' into submodule path 'submodule_lib' failed
00:00:12.543 
00:00:12.543 hudson.plugins.git.GitException: Command "git submodule update --init --recursive" returned status code 1:
00:00:12.543 stdout: 
00:00:12.543 stderr: Cloning into 'submodule_lib'...
00:00:12.543 fatal: Authentication failed for 'http://git.example.com/scm/projects/submodule_lib.git/'
00:00:12.543 Clone of 'http://git.example.com/scm/projects/submodule_lib.git' into submodule path 'submodule_lib' failed
00:00:12.543 
00:00:12.543     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
00:00:12.543     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:63)
00:00:12.543     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:967)
00:00:12.543     at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
00:00:12.543     at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
00:00:12.543     at hudson.remoting.UserRequest.perform(UserRequest.java:152)
00:00:12.543     at hudson.remoting.UserRequest.perform(UserRequest.java:50)
00:00:12.543     at hudson.remoting.Request$2.run(Request.java:332)
00:00:12.543     at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
00:00:12.543     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
00:00:12.543     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
00:00:12.543     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
00:00:12.543     at java.lang.Thread.run(Thread.java:745)
00:00:12.543     at ......remote call to ci-slave-linux1(Native Method)
00:00:12.543     at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
00:00:12.543     at hudson.remoting.UserResponse.retrieve(UserRequest.java:252)
00:00:12.543     at hudson.remoting.Channel.call(Channel.java:781)
00:00:12.543     at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
00:00:12.543     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:00:12.543     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
00:00:12.543     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:00:12.543     at java.lang.reflect.Method.invoke(Method.java:606)
00:00:12.543     at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
00:00:12.543     at com.sun.proxy.$Proxy83.execute(Unknown Source)
00:00:12.543     at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:90)
00:00:12.543     at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1134)
00:00:12.543     at hudson.scm.SCM.checkout(SCM.java:485)
00:00:12.543     at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
00:00:12.543     at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
00:00:12.543     at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
00:00:12.543     at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
00:00:12.543     at hudson.model.Run.execute(Run.java:1738)
00:00:12.544     at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
00:00:12.544     at hudson.model.ResourceController.execute(ResourceController.java:98)
00:00:12.544     at hudson.model.Executor.run(Executor.java:410)

ぐぐるとこんなのが・・・

[JENKINS-20941] Stored git credentials not used when submodule is updated - Jenkins JIRA

つい数日前に直したのでexperimental pluginsからGit Pluginの3.0.0-beta2を入れるとUse credentials from default remote of parent repositoryというのが出るのでそれをチェックすると。なんか良さそうだけど入れたくないなぁ。

というわけで、Disable submodules processingにチェックしてサブモジュールを更新しないようにし、手動で設定ファイルを置いとくことにしました。
Git Pluginが正式リリースされたらもとに戻すということで。