This section contains general information on How To do stuff with Hudson. While the Main Hudson wiki page is a good starting point, it can leave a lot to be desired at times. This section will cover specific eclipse project use cases.
HOW DO I....
The purpose of this page is to provide a brief introduction on how to do various things with Hudson. With the number of plugins available and the number of different ways to configure your job for eclipse, it can get confusing. This page will provide some brief examples and links to ease the learning curve.
Retrieve files from the Last Successful build and use them in the next?
Each build has it's Last Successful Successful build available as a RESTful url. The format for this is:
Replace JOBNAME with the name of the job that you are interested. Any of the artifacts may be accessed and retrieved by giving the full path to it's location. To retrieve a specific ZIP file from a Athena produced build one could use something like:
This would GET the file wst-xsl-SDK-N2000912121209.zip from the build. See Athena's option for creating SNAPSHOTS to create standardized names to make automated retrieval easier.
The following build urls can always be accessed via RESTful API:
- Last Successful
- Last Stable
- Last Build
- Last Failed Build
How do I get a ZIP of all the artifacts produced during a build.
You'll need to make sure that your job is configured to Archive your build artifacts. Once a build produces archived artifacts, you can use the All Files in Zip link to produce and retrieve a zip. The Zip file will have a name of archive.zip.
For example, to get all the artifacts produced by the XSL job for the last successful build you can visit the following link:
Is there an API?
Yes. Hudson provides RESTFul style API for working with the system. You can use this API during your build to automated various portions. For example, retrieve a list of all the artifacts from the Last Successful Build. You may also access any of the artifacts via the URL for that artifact. This allows all a platform independent way to retrieve files from one build and reuse them in another build.
- RESTFul API - retrieve and access files via RESTful web services in XML, JSON or Python data formats.
What URLs provide a RESTful interface?
Any of the following will provide a RESTful interface by adding /api on the end of the url. By appending it with xml, json, or python you can retrieve the information in those data formats. XML restufl also leverages the power of XPath to allow filtering of the data retrieved. See HUDSON's remote API documentation for more information. All Hudson RESTFul API's are backed by an XML Schema so data binding can be done.
Almost any of the URL's available on HUDSON can be accessed restfully. You can experiment with adding the /api method to the end of the URL name.
How do I get a List of Artifacts from the Last Successful Build
You can get a list of artifacts in XML format by accessing your JOB's last succesful build permanent URL an adding /api/xml to the end. For example.
https://build.eclipse.org/hudson/job/cbi-wtp-wst.xsl/lastSuccessfulBuild/api/xml will retrieve an XML formatted file that contains information about the last successful build. You can then use this file as input to a program or a build script to retrieve the artifacts from the build.