2011-11-15 45 views
2

我试图在Hudson中设置参数化版本。这是一个字符串参数,当我手动触发构建时会被设置。这是示例存储库url。
svn://xxx/java/common/tags/${revision}Hudson subversion插件:参数化版本无法找到凭证

我得到了以下异常,当我试图做一个构建与$版本= 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
颠覆插件版本:2.0.1

+0

您能否解释参数化版本的含义?当我做一个新的构建作业,并选中“这个构建参数化”复选框时,我只有少数几个选项。你在那里用过哪一个?它是一个字符串参数,然后在您的URL中用于Subversion?请将此信息添加到问题中。 – mliebelt

+0

是的,这是一个字符串参数,在我的URL中用于颠覆。 – iamsan

回答

0

我已经测试了我们的哈德森装置之一。我做了以下几点:

  1. 创建了一个新的哈德森工作。
  2. 将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}

  3. 然后我添加了一个参数来构建:

    • 类型:字符串参数
    • 名称:项目
    • 默认值:ant-simple
  4. 作为构建步骤,我将Ant定义为目标清理。
  5. 配置对话框告诉我SVN URL(其中${project})不在存储库中,并提供更新凭据。我不做Update credentials

当我现在开始构建,它要求的参数(我没有更改默认的),几秒钟挂起(该消息pending - ???),然后执行构建正确的。为什么这个工作正常(我怀疑,但你可以证明这一点),是哈德森有一个缓存它使用的凭据,如果可能的话。

作为一种解决方法,您应该在没有参数的情况下启动一个构建作业(只需复制当前构建,并通过将URL设置为.../tags/1.0.0.0来删除参数)并构建一次。你必须在那里输入正确的证书,现在参数化版本现在可以工作。

1

Thx mliebelt为您的快速反应。不知何故,我找到了解决方法。 这是我在hudson项目文件夹下找到的subversion.credentials。

您可以看到有一个将网址映射到凭证的散列表。 看看第三项。在运行时,当解析参数$ revision时,插件可能无法找到具有匹配键的凭证。 绝望之余,我在“覆盖全局凭据”上加上了“是”标志,并添加了相同的凭证。这是下面的第四项。它似乎在伎俩。我猜全局身份验证仅基于主机名存储?

<?xml version='1.0' encoding='UTF-8'?> 
<hudson.scm.PerJobCredentialStore> 
    <credentials class="hashtable"> 
    <entry> 
     <string>svn://xxx/java/common</string> 
     <hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential> 
     <userName>chiangs</userName> 
     <password>MWNoaWFuZ3MyMw==</password> 
     </hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential> 
    </entry> 
    <entry> 
     <string>svn://xxx/java/common/trunk</string> 
     <hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential> 
     <userName>chiangs</userName> 
     <password>MWNoaWFuZ3MyMw==</password> 
     </hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential> 
    </entry> 
    <entry> 
     <string>svn://xxx/java/common/tags/${revision}</string> 
     <hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential> 
     <userName>chiangs</userName> 
     <password>MWNoaWFuZ3MyMw==</password> 
     </hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential> 
    </entry> 
    <entry> 
     <string>&lt;svn://xxx:3690&gt; 01f58c58-b008-11dd-a3df-af2b63c5a78d</string> 
     <hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential reference="../../entry[2]/hudson.scm.SubversionSCM_-DescriptorImpl_-PasswordCredential"/> 
    </entry> 
    </credentials> 
</hudson.scm.PerJobCredentialStore> 
+0

+1 - 这需要一段时间才能弄清楚 – bobah

相关问题