Interact with Build Requests

Version 2 by Robin Shen
on Mar 01, 2011 03:15.


compared with
Current by Robin Shen
on Mar 01, 2011 03:17.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

 Build request object can be used to request new build or cancel running build.
  
 {anchor:request new build}
 h1. Request new build
  
 h2. Syntax
 New build can be requested by posting XML representation of the build request object to below url:
 {code}http://localhost:8810/rest/build_requests{code}
 A sample XML of build request object is like below:
 {code}
 <com.pmease.quickbuild.BuildRequest>
  <!-- This element tells QuickBuild in what configuration to trigger build. -->
  <configurationId>10</configurationId>
  
  <!-- This element tells whether or not to respect build condition of the configuration.
  If this is set to true, and if the build condition evaluates to false, build will
  not be triggered. -->
  <respectBuildCondition>false</respectBuildCondition>
  
  <!-- This element is optional and is used to specify variables for build triggering. If
  specified, it will override the variable with the same name defined in configuration
  basic setting. -->
  <variables>
  <entry>
  <string>var_name1</string>
  <string>var_value1</string>
  </entry>
  <entry>
  <string>var_name2</string>
  <string>var_value2</string>
  </entry>
  </variables>
  
  <!-- This element is optional and is used to tell QuickBuild to request a build promotion. -->
  <promotionSource>
  
  <!-- This element is optional and is used to tell QuickBuild that the source build resides on another
  QuickBuild server. -->
  <server>
  <url>http://another-qb-server:8810</url>
  <userName>admin</userName>
  <password>admin</password>
  </server>
  
  <!-- Identifier of the source build to promote from -->
  <buildId>697</buildId>
  
  <!-- This element is optional and used to specify files to promote -->
  <deliveries>
  <com.pmease.quickbuild.FileDelivery>
  <srcPath>artifacts/dir1</srcPath>
  <filePatterns>**/*.jar</filePatterns>
  </com.pmease.quickbuild.FileDelivery>
  <com.pmease.quickbuild.FileDelivery>
  <srcPath>artifacts/dir2</srcPath>
  <filePatterns>**/*.war</filePatterns>
  </com.pmease.quickbuild.FileDelivery>
  </deliveries>
  </promotionSource>
  
 </com.pmease.quickbuild.BuildRequest>
 {code}
  
  The response is of mime type _text/plain_ and the content is XML representation of request result including the generated build request id. Http status code 204 (no content) will be returned if the request is aggregated.
  The response is of mime type _text/plain_ and the content is XML representation of request result including the generated build request id. Http status code 204 (No Content) will be returned if the request is aggregated.
  
 h2. Security
 You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have _RUN_BUILD_ permission for the requested configuration.
  
 h2. Demo
 We use [curl|http://curl.haxx.se/] to demonstrate how to request a build in configuration _root/test_:
 # Get configuration id using [id service|retrieve object identifier]:
 {code}curl http://localhost:8810/rest/ids?configuration_path=root/test{code}
 # Save the sample build request XML described above to file _tempfile.xml_, and modify configuration id to use value returned by the first step.
 # Post content of _tempfile.xml_ to QuickBuild using below command:
 {code}curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/build_requests{code}
  
 {anchor:delete build request}
 h1. Delete a Build Request
  
 h2. Syntax
 Existing build request can be deleted using http DELETE method through below url:
 {code}http://localhost:8810/rest/build_requests/<build request id>{code}
 {note}If the build associated with the build request is already running, it will be forcibly stopped.{note}
  
 h2. Security
 You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have _STOP_BUILD_ permission for the associated configuration.
  
 h2. Demo
 We use [curl|http://curl.haxx.se/] to demonstrate how to delete build request _0136ed89-d47f-4307-8e69-c8535fae0e84_:
 {code}curl -X DELETE -u admin:admin http://localhost:8810/rest/build_requests/0136ed89-d47f-4307-8e69-c8535fae0e84{code}