Help documentation

Artifacts API

The Cruise API documented here is about work in progress. Future versions may change this API.

You can get the list of files or a file for ONLY a given job by the artifacts API.

Key

Parameters
Method URL format HTTPVerb Explanation
list http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job] GET List all files for the particular pipeline/stage/job in html format
list http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job].html GET List all files for the particular pipeline/stage/job in html format
list http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job].json GET List all files for the particular pipeline/stage/job in json format
show http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job]/[filename] GET Get the file called [filename] in default artifact folder of the pipeline/stage/job with particular label.
show http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job]/[pathname]/[filename] GET Get the file called [filename] in the sub-folder [pathname] of default artifact folder of the pipeline/stage/job with particular label.
create http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job]/[filename] POST upload a file named [filename] to the default artifact folder of the particular pipeline/stage/job
append http://[server]/cruise/files/[pipeline]/[label]/[stage]/[stagecounter]/[job]/[filename] PUT appending a string to a file named 'filename' in the default artifact folder of the pipeline/stage/job with particular label
  • You can use key word 'latest' as a pipeline label or a stage counter.
  • StageCounter is a number which indicates how many times the stage has been re-run in the pipeline with the same pipeline label.
  • The name in the RESTful url is case-sensitive.

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 files in json for the latest completed job UnitTest, the command is

curl -u jez:badger http://cruiseserver.com:8153/cruise/files/foo/latest/DEV/1/UnitTest.json

If you want to get the list of files in json for the job UnitTest with the label foo-1.0-1243, the command is

curl -u jez:badger http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-1243/DEV/1/UnitTest.json

If you want to get the file 'foo.war' under the directory 'pkg' for the job UAT with the label foo-1.0-1243, the command is

curl -u jez:badger http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-1243/UATest/UAT/1/pkg/foo.war

If you want to get the list in a folder in json format for the job UAT with the label foo-1.0-1243, the command is

curl -u jez:badger http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-1243/UATest/UAT/1/pkg.json

If you want to upload a file abc.txt to the job UAT with the label foo-1.0-1243 and the target name is def.txt, the command is

curl -u jez:badger -F file=@abc.txt http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-124/UATest/1/UAT/def.txt

If you want to upload a zip file abc.zip to the job UAT with the label foo-1.0-1243 and the target name is def.zip, the command is

curl -u jez:badger -F file=@abc.zip http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-124/UATest/1/UAT/def.zip

If you want to upload a folder to the job UAT with the pipeline label foo-1.0-1243, and the folder name would be 'def', the command is

You have to zip the folder before uploading it.

curl -u jez:badger -F zipfile=@abc.zip http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-1243/UATest/1/UAT/def

If you want to append the content of a file, say abc.txt, to the end of a file 'def.txt' to the job UnitTest with the label foo-1.0-1243, the command is

curl -u jez:badger -T abc.txt http://cruiseserver.com:8153/cruise/files/foo/foo-1.0-1243/DEV/UnitTest/1/def.txt

Cruise does not support 'lastgood' options for RESTful URL in R1.2.