How to get build number used by Copy Artifact plugin

311 views
Skip to first unread message

Graham Smith

unread,
Feb 4, 2011, 11:27:40 AM2/4/11
to jenkins...@googlegroups.com
Hi,

I'm using the Copy Artifact plugin on my Hudson install.

I'm using it successfully to copy artifacts from a build job into a
later (deployment) job.
It copies artifacts from the last stable build and whilst the console
log shows which build number this is, I can't see how to retrieve this
build number within my job.

I was hoping the plugin creates an environment variable or something
to allow later build steps to know which build number is being used.

Can someone tell me how it makes the build number used available - or
confirm that it doesn't.

Many Thanks,
Graham

Sami Tikka

unread,
Feb 6, 2011, 4:16:08 PM2/6/11
to jenkins...@googlegroups.com
Sorry, I don't know how to get it using Copy Artifact plugin.

But you can get the build number from

http://YOURHUDSON/job/JOBNAME/X/buildNumber

where X is "lastBuild", "lastSuccessfulBuild", "lastStableBuild" and so on. It is easy to read this URL in a build script using a command line utility like wget or using standard HTTP libraries in script languages like python or perl or ruby or...

-- Sami

Graham Smith

unread,
Feb 8, 2011, 5:14:19 AM2/8/11
to jenkins...@googlegroups.com
Hmm, that could work - but I'm not sure that my Hudson server has any
easy way to parse that URL. I'm running on windows 2003 that does not
have anything installed bar Hudson and Visual Studio. So no wget, no
scripting languages, etc.

If no-one can suggest an no easy way to do this on vanilla windows
(win2003 server or win7), I can probably write a wget-like utility to
do this for me - and perhaps I'll raise a feature request on the
plugin....

Many Thanks, Graham

Swindells, Thomas

unread,
Feb 8, 2011, 5:20:20 AM2/8/11
to jenkins...@googlegroups.com
You'll probably have some of the standard windows scripting language tools installed (eg vbscript etc) the other option is just to copy wget or whatever onto the machine (you could even get Hudson to manage this if you really want). Or use one of the plugins which allow you to run arbitary scripts.

Thomas


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postm...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

Sami Tikka

unread,
Feb 11, 2011, 4:51:31 PM2/11/11
to jenkins...@googlegroups.com
Hmm... Your server is running Hudson. So it has Java installed, right? You could configure Hudson to auto-install Ant, then make an Ant build-file that calls for Ant to download the URL.

-- Sami

Reply all
Reply to author
Forward
0 new messages