(注:このブログはもう更新していません)この日記は私的なものであり所属会社の見解とは無関係です。 GitHub: takahashikzn

[クラウド帳票エンジンDocurain]

JenkinsのSVN Pluginsで"E170001: Authentication required"を解消する

以前もどこかで書きましたが、ウチは未だにSVNです。理由は次の通り。

  • svn:externalsにかなり依存した構成管理をしている
    • gitのサブモジュールはsvn:externalsのような柔軟性が無く微妙
  • それぞれのメンバーが触る範囲が明確に分かれておりコンフリクトがほぼ起きない
  • 変更管理はRedmine-SVN連携で賄えている
    • よってコミットログの綺麗さにそこまでこだわりが無い

要するに、SVNで困っているわけでは無いのです。

「まだSVNで消耗してるの?」と煽られることにさえ目をつぶれば…

本日のお題

さて、以前からずっと

svn: E170001: Authentication required for 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

に悩まされていたのですが、本日やっと解消できました。

ヒントになった情報はこの2つ。

http://hidari-lab.hatenablog.com/entry/2016/03/06/010454

http://stackoverflow.com/questions/34206295/jenkins-now-needs-a-realm-for-svn-how-do-you-find-it-out-and-what-should-be

“Additional Credentials"が必須

まずは1つめのURLについて。

svn:externals を使っているリポジトリをJenkins で触るときは必ず [Additional Credentials] を指定しておくのが正解っぽい。

とのことです。要するに、ジョブの設定で

f:id:takahashikzn:20170713150802p:plain

を常に指定しておけということです。

Realm名にご用心

次に2つめのURLについて。こちらが決め手になりました。

I realized that the Authentication realm is a string of the form <http://path_to_svn_rep:port> Realm Name that needs to be set in Jenkins. The struggle was to find what the Realm Name was.

認証レルムの文字列は「<http://path_to_svn_rep:port> レルム名」という形式でなければならないことがわかった。これがなかなか分からなくて苦労した。

とのことです。

svn:externalsのチェックアウト時に例外が出ていると思うのですが、それはこんな形式のはずです。

No credentials found for realm ‘<svn://path_to_svn_rep:port> xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’ among ‘xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’; falling back to <none>
org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:68)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
...

で、よく見てみると、

<svn://path_to_svn_rep:port> xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

とあるじゃないですか。この文字列をそのままレルム名にする必要がある。

そんなのわかんねーぞ普通。


とまあ、上記2つの通りに対応したらエラーが出ないようになりました。 めでたしめでたし。