Hudson subversion 插件:参数化构建找不到凭据
我尝试在 Hudson 中设置参数化构建。它是一个字符串参数,当我手动触发构建时将设置该参数。这是示例存储库 URL。
svn://xxx/java/common/tags/${revision}
当我尝试使用 $revision=1.0.0.0 进行构建时,出现以下异常
error: failed to check out svn://xxx/java/common/tags/1.0.0.0
org.tmatesoft.svn.core.SVNCancelException: svn: No credential to try. Authentication failed
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:37)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:32)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:219)
at org.tmatesoft.svn.core.internal.io.svn.sasl.SVNSaslAuthenticator.createSaslClient(SVNSaslAuthenticator.java:304)
at org.tmatesoft.svn.core.internal.io.svn.sasl.SVNSaslAuthenticator.authenticate(SVNSaslAuthenticator.java:91)
at org.tmatesoft.svn.core.internal.io.svn.SVNConnection.authenticate(SVNConnection.java:173)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.authenticate(SVNRepositoryImpl.java:1265)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.openConnection(SVNRepositoryImpl.java:1243)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.getLatestRevision(SVNRepositoryImpl.java:168)
at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber(SVNBasicClient.java:482)
at org.tmatesoft.svn.core.wc.SVNBasicClient.getLocations(SVNBasicClient.java:873)
at org.tmatesoft.svn.core.wc.SVNBasicClient.createRepository(SVNBasicClient.java:534)
at org.tmatesoft.svn.core.wc.SVNUpdateClient.doCheckout(SVNUpdateClient.java:901)
我已经设置了用户名/上面存储库 url 的密码。由于 url 是动态生成的,Subversion 插件似乎无法获取凭据。如果我将 URL 设置为静态 URL 并相应地设置用户名/密码,我就可以查看该项目。任何帮助将不胜感激。谢谢。
哈德森版本:2.1.0
Subversion 插件版本:2.0.1
I tried to set up a parameterized build in Hudson. It is a string parameter that will be set when I trigger a build manually. This is the sample repository url.svn://xxx/java/common/tags/${revision}
I got the following exception when I tried to do a build with $revision=1.0.0.0
error: failed to check out svn://xxx/java/common/tags/1.0.0.0
org.tmatesoft.svn.core.SVNCancelException: svn: No credential to try. Authentication failed
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:37)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:32)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:219)
at org.tmatesoft.svn.core.internal.io.svn.sasl.SVNSaslAuthenticator.createSaslClient(SVNSaslAuthenticator.java:304)
at org.tmatesoft.svn.core.internal.io.svn.sasl.SVNSaslAuthenticator.authenticate(SVNSaslAuthenticator.java:91)
at org.tmatesoft.svn.core.internal.io.svn.SVNConnection.authenticate(SVNConnection.java:173)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.authenticate(SVNRepositoryImpl.java:1265)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.openConnection(SVNRepositoryImpl.java:1243)
at org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.getLatestRevision(SVNRepositoryImpl.java:168)
at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber(SVNBasicClient.java:482)
at org.tmatesoft.svn.core.wc.SVNBasicClient.getLocations(SVNBasicClient.java:873)
at org.tmatesoft.svn.core.wc.SVNBasicClient.createRepository(SVNBasicClient.java:534)
at org.tmatesoft.svn.core.wc.SVNUpdateClient.doCheckout(SVNUpdateClient.java:901)
I have already set up the username/password for the repository url above. It seems like Subversion plugin failed to get the credential as the url is dynamically generated. If I set up the URL as a static one and set up the username/password accordingly, I am able to check out the project. Any help will be greatly appreciated. Thx.
Hudson version: 2.1.0
Subversion plugin version: 2.0.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢 mliebelt 的快速回复。不知怎的,我找到了一个解决方法。
这是我在 hudson 项目文件夹下找到的 subversion.credentials。
您可以看到有一个哈希表将 url 映射到凭证。
看一下第三个条目。在运行时,当参数 $revision 被解析时,插件可能无法找到具有匹配密钥的凭证。
出于无奈,我添加了相同的凭据,并添加了“覆盖全局凭据”,并打开了“是”标志。这是下面的第四个条目。看来确实能达到目的。我猜全局身份验证仅基于主机名存储?
Thx mliebelt for your quick response. Somehow I find a workaround.
This is the subversion.credentials I found under the hudson project folder.
You can see that there is a hashtable that map an url to a credential.
Take a look at the third entry. At runtime, when the parameter $revision is resolved, the plugin may fail to find a credential with matching key.
Out of desperation, I added the same credential with the "Override global credentials" with the "Yes" flag on. That is the fourth entry below. It seems to do the trick. I guess the global authentication is stored based on the hostname only?
我已经在我们的哈德逊装置之一上对其进行了测试。我已完成以下操作:
将 SVN URL 复制到 Ant 项目,并将最后一段替换为 `${project}。
之前:
https://our.svn.com/svn/trunk/public/develop/build/ant/ant-simple
现在是:
https://our.svn.com/svn/trunk/public/develop/build/ant/${project}
然后我向构建添加了一个参数:
${project}
),并提供更新凭据。更新凭据
。当我现在开始构建时,它会询问参数(我不更改默认值),挂起几秒钟(带有消息
pending - ???
),然后构建正确。这是有效的原因(我怀疑,但你可以证明这一点),是 Hudson 有一个缓存,用于存储它正在使用的凭证(如果可能的话)。作为一种解决方法,您应该启动一个不带参数的构建作业(只需复制当前构建,然后通过将 URL 设置为
.../tags/1.0.0.0
来删除参数)并构建一次。您必须在那里输入正确的凭据,现在参数化构建应该可以工作了。I have tested it on one of our Hudson installations. I have done the following:
Copied the SVN URL to an Ant project, and replaced the last segment by `${project}.
Before it was:
https://our.svn.com/svn/trunk/public/develop/build/ant/ant-simple
Now it is:
https://our.svn.com/svn/trunk/public/develop/build/ant/${project}
Then I added a parameter to the build:
${project}
in it) does not exist in the repository and offers to update the credentials.Update credentials
.When I start now the build, it asks for the parameter (I don't change the default), hangs for some seconds (with the message
pending - ???
), and then does the build correct. The reason why this is working (I suspect that, but you can prove it), is that Hudson has a cache for credentials that it is using if possible.You should as a workaround start one build job without the parameter (just copy your current build, and remove the parameter by setting the URL to
.../tags/1.0.0.0
) and build it once. You have to enter there the correct credentials, and now the parameterized build should now work.