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/archive/2011/10/11/2206914.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值