Hudson: how do i use a parameterized build to do svn checkout and svn tag?

笑着哭i 提交于 2019-12-05 01:21:22

问题


I'm setting up a parameterized build in hudson v1.362. the parameter i'm creting is used to determine which branch to checkout in subversion.

I can set my svn repository url like this: https://my.svn.server/branches/${branch} and it does the checkout and the build just fine.

now I want to tag the build after it finishes. i'm using the SVN tagging plugin for hudson to do this. so i go to the bottom of the project config screen for the hudson project and turn on "Perform Subversion tagging on successful build".

here, i set my Tag Base URL to https://my.svn.server/tags/${branch}-${BUILD_NUMBER} and it gives me errors about those properties not being found. so i change them to environment variable usages like this: https://my.svn.server/tags/${env['branch']}-${env['BUILD_NUMBER']} and the svn tagging plugin is happy.

the problem now is that my svn repository at the top is using the ${branch} syntax and the svn tagging plugin barfs on this:

moduleLocation: Remote ->https://my.svn.server/branches/$branch/
Tag Base URL: 'https://my.svn.server/tags/thebranchiused-1234'.
There was no old tag at https://my.svn.server/tags/thebranchiused-1234.
ERROR: Publisher hudson.plugins.svn_tag.SvnTagPublisher aborted due to exception
java.lang.NullPointerException
    at hudson.plugins.svn_tag.SvnTagPlugin.perform(SvnTagPlugin.java:180)
    at hudson.plugins.svn_tag.SvnTagPublisher.perform(SvnTagPublisher.java:79)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:580)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:558)
    at hudson.model.Build$RunnerImpl.cleanUp(Build.java:167)
    at hudson.model.Run.run(Run.java:1295)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:124)
Finished: FAILURE

notice the first line, there: the svn tag is looking at ${branch} as part of the repository url... it's not parsing out the property value.

i tried to change my original Repository URL for svn to use the ${env['branch']} syntax, but that blows up on the original checkout because this syntax is not getting parsed at all by the checkout.

help?!

how do i use a parameterized build to set the svn url for checkout and for tagging my build?!


回答1:


We don't use the tagging plugin, but we do use SVN.EXE in our shell script like this:

svn cp %workspace%\trunk@ http://myserver/release/%build_number%/trunk -m "(put log text here)" --parents

Perhaps something similar will work for you too.




回答2:


We use the tagging pluggin with the following URL:

http://subversion.repository/branches/jenkinstest_tags//build-${env['BUILD_NUMBER']}

and it works. We had to use a double '//' as in '/jenkinstest_tags//build' . Which seems to a workaround.



来源:https://stackoverflow.com/questions/3062569/hudson-how-do-i-use-a-parameterized-build-to-do-svn-checkout-and-svn-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!