How to automatically build the latest svn tag

1,638 views
Skip to first unread message

Martin Grotzke

unread,
Jun 19, 2012, 8:07:51 AM6/19/12
to jenkins...@googlegroups.com
Hi,

I want jenkins to automatically select the latest tag for a build.

I have configured the build parameter

"List Subversion Tags" with
Name = SVN_TAG
Repository URL = http://someproj.googlecode.com/svn/tags
Maximum tags to display = 1
Sort newest first = true

The Source Code Management / Subversion is configured with
Repository URL = http://someproj.googlecode.com/svn/tags/$SVN_TAG

When I trigger a build (manually) jenkins tells me that "This build
requires parameters:" and provides a drop down for SVN_TAG with a single
value.
Instead, I expect jenkins to build this tag automatically.

I have also configured "Poll SCM" as build trigger, and the subversion
polling log tells that
"Location 'http://reflectasm.googlecode.com/svn/tags/$SVN_TAG' does
not exist"

Is it possible to automatically build the latest svn tag, what's the
correct configuration for this?

Thanx && cheers,
Martin

Nilesh Bhatt

unread,
Jun 4, 2015, 10:18:14 PM6/4/15
to jenkins...@googlegroups.com, martin....@googlemail.com
Hi, I'm not sure if you still need an answer to this but I recently had to do something similar and this is what I did to make it work...

In your Jenkins job, choose "Prepare an environment for the run" option and add to "Script Content" something like this:
-----
export SVN_TAG=`svn ls --username someuser --password somepass --non-interactive http://someproj.googlecode.com/svn/tags |tail -1`
echo "SVN_TAG=$SVN_TAG" >propsfile
-----

You can then use the repo url under SCM as you've listed above... http://someproj.googlecode.com/svn/tags/$SVN_TAG

Finally, under Build Environment, choose "Inject environment variables to the build process" and enter "propsfile" for "Properties File Path".

Good luck!
Nilesh.

Nico van de Kamp

unread,
Aug 2, 2019, 9:47:09 AM8/2/19
to Jenkins Users
Question:

I'm not familiar with this specific but I try to get the last version of a tag from SVN. I found this.

SVN is installed on another server than the Jenkins server. 

So to run command: export SVN_TAG=`svn ls --username someuser --password somepass --non-interactive http://someproj.googlecode.com/svn/tags |tail -1` , I think an svn client needs to be installed on the jenkins server? Otherwise get the message "svn command not found". Is that right or do I miss something?

In the past I use (putty if I remember well) for tunneling: svn+ssh://<user>@<url>, is that also possible with this construction?

Or does someone have a better idea?

Nico

Robert Hindle

unread,
Feb 27, 2023, 5:02:27 PM2/27/23
to Jenkins Users
Thanks Nilesh. Most helpful.
Reply all
Reply to author
Forward
0 new messages