2011-11-15 48 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

相關問題