Properties API
The Cruise API documented here is a work in progress. Future versions may change this API.
You can get the list of properties or a property's value for a given job by using the properties API.
There is no way to delete or update a property.Standard properties
The standard properties defined by cruise are:
- cruise_agent -- the agent that is running the job
- cruise_job_duration -- total time to run the job
- cruise_job_result -- one of "passed" or "failed"
- cruise_job_id -- the name of the folder that the artifacts of the job was stored in under the artifact repository on server side (on earlier versions of Cruise).
- cruise_pipeline_label -- same as the value of the environment variable PIPELINE_LABEL
- cruise_timestamp_01_scheduled -- time at which the job was scheduled
- cruise_timestamp_02_assigned -- time at which the job was assigned to the agent
- cruise_timestamp_03_preparing -- time at which the job entered the "preparing" state
- cruise_timestamp_04_building -- time at which the job started building
- cruise_timestamp_05_completing -- time at which the job entered the completing state
- cruise_timestamp_06_completed -- time at which the job completed
Key
StageCounter is a number which indicate how many times the stage has been run in the pipeline with the same pipeline label.
| Method | URL format | HTTPVerb | Explanation |
|---|---|---|---|
| list | http://[server]:8153/cruise/properties/[pipeline]/[label]/[stage]/[stagecounter]/[job] | GET | List all properties for the specific pipeline/stage/job in csv format. |
| show | http://[server]:8153/cruise/properties/[pipeline]/[label]/[stage]/[stagecounter]/[job]/[propertyname] | GET | Get the value of the property [propertyname] of the specific pipeline/stage/job with csv format. |
| create | http://[server]:8153/cruise/properties/[pipeline]/[label]/[stage]/[job]/[propertyname] | POST | create a property with value to the specific pipeline/stage/job. |
| search | "http://[server]:8153/cruise/properties/search?pipelineName=[pipeline]&stageName=[stage]&jobName=[job]&limitLabel=1.2.2396&limitCount=[number]" | GET | List all properties for the pipeline/stage/job in csv format. |
- You can use key word 'latest' as a pipeline label or a stage counter.
- RESTful urls are case sensitive.
- Cruise does not support JSON format for properties API.
Examples
- We use curl, a command line tool for transferring files with URL syntax, in the following examples. Of course, you can use any HTTP client library.
- We assume that the url of the cruise server is http://cruiseserver.com:8153/ .
- We assume security has been switched on, and that there is a user named jez with the password badger .
And the pipeline configuration looks like:
<pipeline name="foo" labeltemplete="foo-1.0-${COUNT}">
<material>
<svn url="...."/>
</material>
<stage name="DEV">
<job name="UnitTest">
<tasks>
<ant target="ut"/>
</tasks>
<artifacts>
<artifact src="coverage" dest="coveragereport.html"/>
</artifacts>
</job>
</stage>
<stage name="UATest">
<job name="UAT">
<tasks>
<ant target="all-UAT"/>
</tasks>
<artifacts>
<artifact src="report" dest="UAreport.html"/>
<artifact src="target" dest="pkg/foo.war"/>
</artifacts>
</job>
</stage>
</pipeline>
If you want to get the list of properties in csv for the job UnitTest with the label 'foo-1.0-1243' and stage counter 'LATEST', the command is
curl -u jez:badger http://cruiseserver.com:8153/cruise/properties/foo/foo-1.0-1243/DEV/LATEST/UnitTest
If you want to get the history of properties in csv for the job UnitTest, the command is
curl -u jez:badger "http://[server]:8153/cruise/properties/search?pipelineName=foo&stageName=DEV&jobName=UnitTest&limitLable=100"
The quotes are required.
If you want to get a property 'cruise_agent' for the job UnitTest with the label foo-1.0-1243 and stage counter '1', the command is
curl -u jez:badger http://cruiseserver.com:8153/cruise/properties/foo/foo-1.0-1243/DEV/1/UnitTest/cruise_agent
If you want to define a property, named myproperty, for the job UnitTest with the label foo-1.0-1243 and stage counter '1', the command is
curl -u jez:badger -d "value=Showcase_for_I29" http://10.18.3.168:8153/cruise/properties/foo/foo-1.0-1243/DEV/1/UnitTest/myproperty