代码之家  ›  专栏  ›  技术社区  ›  user2427

你能和哈德逊一起做吗?

  •  2
  • user2427  · 技术社区  · 15 年前

    我想创建一个hudson作业,它以id作为参数。并使用该id计算svn repo路径。

    在我工作的地方,你对你解决的每一个问题都有一个SVN路径。然后将所有问题连接到单个svn路径中。

    我想做的是对部分问题运行静态代码分析。

    因此,我认为可能有一个Ant build.xml用于每个问题,然后,使用问题ID参数化作业。

    我已经尝试过了,但是svn路径并没有替换参数。

    我试过了 #issueId , %issueId% , ${issueId} ${env.issueId} 没有成功。

    跳转错误如下:

    Location 'http://svn-path:8181/svn/devSet/issues/${env.chuid}' does not exist
    Checking out a fresh workspace because C:\Documents and Settings\dnoseda\.hudson\jobs\test\workspace\${env.chuid} doesn't exist
    Checking out http://svn-path:8181/svn/devSet/issues/${env.chuid}
    ERROR: Failed to check out http://svn-path:8181/svn/devSet/issues/${env.chuid}
    org.tmatesoft.svn.core.SVNException: svn: '/svn/!svn/bc/46190/devSet/issues/$%7Benv.chuid%7D' path not found: 404 Not Found (http://svn-path:8181)
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
        at 
    

    我认为我不能做我想做的事。

    你知道我如何设置正确的配置来实现这一点吗?

    谢谢你的帮助。

    编辑 我要放置此参数的配置作业部分如下:

    <scm class="hudson.scm.SubversionSCM">
    <locations>
          <hudson.scm.SubversionSCM_-ModuleLocation>
            <remote>http://svn-path:8181/svn/devSet/issues/${env.issueid}</remote>
          </hudson.scm.SubversionSCM_-ModuleLocation>
        </locations>
    

    新编辑:已解决

    我的hudson版本是最后一个(1.349),但是svn插件的版本是1.11,是最后一个1.13,它可以与 ${SeaSeID}

    感谢安沃斯夫妇

    3 回复  |  直到 15 年前
        1
  •  3
  •   Michael Donohue Reno    15 年前

    我已经设置了一个svn项目,它成功地完成了参数替换。语法确实是 ${issueId} 所以我想你是做错了什么,或者是用了一个很老版本的哈德逊。你能用hudson和subversion插件的版本更新这个问题吗?

    <project> 
      <actions/> 
      <description></description> 
      <keepDependencies>false</keepDependencies> 
      <properties> 
        <hudson.model.ParametersDefinitionProperty> 
          <parameterDefinitions> 
            <hudson.model.StringParameterDefinition> 
              <name>issueId</name> 
              <description></description> 
              <defaultValue>none</defaultValue> 
            </hudson.model.StringParameterDefinition> 
          </parameterDefinitions> 
        </hudson.model.ParametersDefinitionProperty> 
      </properties> 
      <scm class="hudson.scm.SubversionSCM"> 
        <locations> 
          <hudson.scm.SubversionSCM_-ModuleLocation> 
            <remote>https://svn.dev.java.net/svn/hudson/trunk/${issueId}</remote> 
          </hudson.scm.SubversionSCM_-ModuleLocation> 
        </locations> 
        <useUpdate>true</useUpdate> 
        <excludedRegions></excludedRegions> 
        <excludedUsers></excludedUsers> 
        <excludedRevprop></excludedRevprop> 
      </scm> 
      <canRoam>true</canRoam> 
      <disabled>false</disabled> 
      <triggers class="vector"/> 
      <concurrentBuild>false</concurrentBuild> 
      <builders/> 
      <publishers/> 
      <buildWrappers/> 
    </project>
    

    这是生成输出。由于身份验证问题,签出失败,但参数已成功替换:

    Started by user anonymous
    Building on master
    Checking out a fresh workspace because C:\hudson\jobs\test-svn\workspace\${issueId} doesn't exist
    Checking out https://svn.dev.java.net/svn/hudson/trunk/www
    ERROR: Failed to check out https://svn.dev.java.net/svn/hudson/trunk/www
    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:168)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:534)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:273)
        at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:261)
        at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:516)
        at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:98)
        at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1001)
        at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.getLatestRevision(DAVRepository.java:178)
        at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber(SVNBasicClient.java:482)
        at org.tmatesoft.svn.core.wc.SVNBasicClient.getLocations(SVNBasicClient.java:851)
        at org.tmatesoft.svn.core.wc.SVNBasicClient.createRepository(SVNBasicClient.java:534)
        at org.tmatesoft.svn.core.wc.SVNUpdateClient.doCheckout(SVNUpdateClient.java:893)
        at org.tmatesoft.svn.core.wc.SVNUpdateClient.doCheckout(SVNUpdateClient.java:791)
        at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:615)
        at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:541)
        at hudson.FilePath.act(FilePath.java:676)
        at hudson.FilePath.act(FilePath.java:660)
        at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:534)
        at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:482)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:898)
        at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:400)
        at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:349)
        at hudson.model.Run.run(Run.java:1106)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:93)
        at hudson.model.Executor.run(Executor.java:122)
    Notifying upstream projects of job completion
    Finished: FAILURE
    
        2
  •  4
  •   Tomislav Nakic-Alfirevic    15 年前

    hudson wiki :

    “该参数可用作环境参数。因此,shell($foo,%foo%)或ant(${env.foo})可以访问这些值。”

    您的语法与wiki中的语法不匹配。

        3
  •  2
  •   prestomation    15 年前

    在这 comment ,有人提到他们使用${issueid},这就是我建议使用它的原因,但我看到的所有其他迹象都表明这实际上不起作用。

    否则,我建议不要使用scm插件并在构建脚本步骤中执行svn操作。这将允许您使用参数作为env变量,如$issueid