hudson/jenkins中指定svn签出的版本

   hudson中使用svn签出代码时,

如果使用 http://svn_ulr/repo , 则是表示签出最新HEAD的版本

如果使用 http://svn_url/repo@NNN ,则标识签出revision为NNN的代码

---------------------------------------------------------------------------------------------------

解决方案

对于由手动触发生成构建,可以使用如下方案

1,给job添加一个string型的参数,比如REVISION

2,添加该变量到svn库地址最后,比如 http://svn_url/repo$%7BREVISION}

此时hudson会提示地址是否无效,没关系,在具体使用时,变量会被展开成有效的地址

3,保存

使用时,填写@NNN,指定revision。也可以留空,则是HEAD

目前的问题:还没有解决多个job间,参数传递的问题。

关于带参数job的使用参考

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

 ===============================================================

You have to do a few things to build exactly each revision:

  • add a REVISION string parameter to your job
  • append the ${REVISION} parameter to the repository URL,
    eg: https://server/path/myproject${REVISION}
  • set the name of the local folder to 'myproject' (see previous example), because the REVISION variable is only expanded in the URL, but when creating the folder, Hudson will not expand it, resulting in a folder named: 'myproject${REVISION}'
  • trigger the parameterized build from the post-commit hook, like that:
    /usr/bin/wget \
    --auth-no-challenge \
    --no-check-certificate \
    --user=me \
    --password=mypasswd \
    https: //server/path/job/jobname/buildWithParameters?delay=0sec\&REVISION=%40$REV \
    -O /dev/null

If you want to trigger a build manually, you have two possibilities:

  • if you want to build HEAD revision, you must leave the REVISION parameter empty
  • if you want to build a specific revision, you have to enter @NNN (eg: @1234).

The 'at sign' is very important because all this trick relies on the fact that Subversion plugin interprets URL@NNN as 'get revision NNN from repository at URL'. If you forget the @, Subversion will just say it can't find folder https: //server/path/myprojectNNN. That's also why you have to put %40 between REVISION= and $REV in the wget command, %40 is the escaped character for @.

原文地址:https://www.cnblogs.com/kevinzhwl/p/2206914.html