In Hudson we have a job that deploys a specified subversion tag to a server. This tag is currently entered in a text field, but since that is just a typing mistake waiting to happen, we would like that text field to be replaced by a drop down list with the currently available tags. That is, we would like Hudson to go to <subversion repo url>/tags and fetch all tags found there.
I’ve searched for a Hudson plugin or some other way to accomplish this, with no success. This can’t be the first time someone wants this, right? Or would this be considered bad practice for some reason that I can not think of at the moment?
EDIT
Someone else did have the same idea (only three weeks ago), but there is no posted solution right now: http://issues.hudson-ci.org/browse/HUDSON-6682?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
EDIT 2
I have now implemented Zachary Young’s answer and after a few modifications for our environment it works perfectly.
Our modifications:
We have international content encoded in UTF-8 and I had to add that to join.xsl:
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
and to the curl command that uploads the new config:
curl -H "Content-Type: text/xml; charset=UTF-8" -X POST --data-binary @$WORKING_DIR/new-config.xml $HUDSON_CONFIG_PATH -u $USER:$PASSWORD
That’s what I remember at the moment at least.
This is now placed in an external script, but I will put it in a Hudson job to make it possible for the other developers to run it easily.
I urge everyone to upvote Zachary Young’s answer!
UPDATE 01:
This is now is part of the Subversion Plugin that ships with
jenkins/hudson.war.In lieu of a Hudson plug-in (I do not know Java), how about some XSL (1.0)? In the following solution :
svn list --xml, saved to svn-list.xml1.
svn list --xml2. Convert SVN list to Hudson list
svn-to-hudson.xsl:
3. Join Hudson List with Job’s config.xml
The following uses
curlto get fetch the old config.xml, and to post the new one, utilizing Hudson’s job API for modifying the config.join.xsl requires the presence of hudson-list.xml in the same directory:
You will also need to modify
to the name of your list in the job (e.g., ‘SVN tags’, ‘Tagged Builds’, etc…).
join.xsl:
I hope this end-to-end solution works for you.
Thank you,
Zachary