Interact with Builds

Build psuedo id

To facilitate the interaction with builds, the build psuedo id is used. A build psuedo id is of below formats:

format meaning
<build id> A certain build id, for example: 100
<configuration id>.latest Latest build of specified configuration, for example: 2.latest
<configuration id>.latest_finished Latest finished build of specified configuration, for example: 2.latest_finished
<configuration id>.latest_successful Latest successful build of specified configuration, for example: 2.latest_successful
<configuration id>.latest_recommended Latest recommended build of specified configuration, for example: 2.latest_recommended
<configuration id>.latest_failed Latest failed build of specified configuration, for example: 2.latest_failed

Access build by psuedo id

Syntax

Build can be accessed by build psuedo id using http GET method through below url:

http://localhost:8810/rest/build?id=<build psuedo id>

The response is of mime type application/xml, and the content is xml representation of the build.

Security

You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.

Demo

Below curl command demostrates how to access xml representation of the latest build of the configuration with id 2:

curl -u admin:admin http://localhost:8810/rest/build?id=2.latest

Access build by configuration id and build version

Syntax

Build can be accessed by configuration id and build version using http GET method through below url:

http://localhost:8810/rest/build?configuration_id=<configuration id>&version=<build version>

The response is of mime type application/xml, and the content is xml representation of the build.

Security

You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.

Demo

Below curl command demostrates how to access xml representation of build 1.0.6 in configuration with id 2:

curl -u admin:admin "http://localhost:8810/rest/build?configuration_id=2&version=1.0.6"

Access build status by psuedo id

Syntax

Build status can be accessed by build psuedo id using http GET method through below url:

http://localhost:8810/rest/build/status?id=<build psuedo id>

The response is of mime type text/plain, and the content is string representation of the build status.

Security

You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.

Demo

Below curl command demostrates how to access build status of latest build in configuration with id 2:

curl -u admin:admin http://localhost:8810/rest/build/status?id=2.latest

Access build id by psuedo id

Syntax

Build id can be accessed by build psuedo id using http GET method through below url:

http://localhost:8810/rest/build/id?id=<build psuedo id>

The response is of mime type text/plain, and the content is string representation of the build id.

Security

You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.

Demo

Below curl command demostrates how to access build id of latest build in configuration with id 2:

curl -u admin:admin http://localhost:8810/rest/build/id?id=2.latest

Access executed steps by build psuedo id

Syntax

Executed steps of a build can be accessed by psuedo id using http GET method through below url:

http://localhost:8810/rest/build/steps?id=<build psuedo id>

The response is of mime type application/xml, and the content is the list of steps executed in the build.

Security

You will need to use http BASIC authentication to login as QuickBuild administrator if the anonymous does not have administrative permission.

Demo

Below curl command demostrates how to access executed steps by latest build in configuration with id 2:

curl -u admin:admin http://localhost:8810/rest/build/steps?id=2.latest

Access used repositories by build psuedo id

Syntax

Used repositories of a build can be accessed by psuedo id using http GET method through below url:

http://localhost:8810/rest/build/repositories?id=<build psuedo id>

The response is of mime type application/xml, and the content is the list of repositories used in the build.

Security

You will need to use http BASIC authentication to login as QuickBuild administrator if the anonymous does not have administrative permission.

Demo

Below curl command demostrates how to access used repositories by latest build in configuration with id 2:

curl -u admin:admin http://localhost:8810/rest/build/repositories?id=2.latest

Search builds

Syntax

Builds can be searched using http GET method through below url:

http://localhost:8810/rest/builds?<search criteria1>=<value1>&<search criteria2>=<value2>&...

Query string part of the url represents various search criterias to restrict the search result. Supported search criterias are:

Search criteria Explanation
configuration_id This tells QuickBuild under which configuration id to search builds. If not specified, all configurations will be searched.
recursive If set to true, QuickBuild will also search builds in all descendent configurations of specified configuration. The value is assumed as false if not specified.
from_date In the format of yyyy-MM-dd, for example: 2009-11-12. If specified, search builds generated after this date
to_date In the format of yyyy-MM-dd, for example: 2009-11-12. If specified, search builds generated before this date
version Specify the build version to match. The character * can be used in the version string to do wildcard match. If not specified, all versions will be matched.
status Status of the build to match. Valid build statuses are: SUCCESSFUL, FAILED, RECOMMENDED, CANCELLED, RUNNING, WAITING. If left empty, any build status will be matched.
user_id Match builds which is triggered by specified user. If not specified, builds triggered by any user will be matched.
index Specify start position of search results. Position 0 is assumed if this param is not specified.
count Specify number of builds to return. All matching builds will be returned if this param is not specified.

If no any search criterias specified, all builds in the system will be returned.

Security

You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have permission to access returned builds.

Demo

Below curl commands demonstrates how to combine different criterias to perform search:

  1. Search all failed builds under configuration with id 2:
    curl -u admin:admin "http://localhost:8810/rest/builds?configuration_id=2&status=FAILED"
  2. Search all successful builds generated before 2009-11-12 in the system:
    curl -u admin:admin "http://localhost:8810/rest/builds?status=SUCCESSFUL&to_date=2009-11-12"
  3. Search all failed builds with version containing qa:
    curl -u admin:admin "http://localhost:8810/rest/builds?version=*qa*&status=FAILED"

Trigger build

Syntax

Build can be triggered by posting the triggering parameter xml to below url:

http://localhost:8810/rest/trigger

A sample triggering parameter xml is like below:

<com.pmease.quickbuild.rest.TriggerParams>
  <!-- This element tells QuickBuild in what configuration to trigger build. -->
  <configurationId>2</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 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>name1</string>
      <string>value1</string>
    </entry>
    <entry>
      <string>name2</string>
      <string>value2</string>
    </entry>
  </variables>
  
  <!-- This element tells QuickBuild whether or not to wait for finishing of the build. -->
  <waitForFinish>false</waitForFinish>
</com.pmease.quickbuild.rest.TriggerParams>

The response is of mime type text/plain and the content is string representation of newly generated build id. If the element respectBuildCondition is set to true, and if the build condition evaluates to false, id of latest build of specified configuration will be returned instead.

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.

Demo

We use curl to demonstrate how to trigger a build in configuration with id 2:

  1. Save the sample triggering param xml described above to file tempfile.xml.
  2. Post content of tempfile.xml to QuickBuild using below command:
    curl -X POST -u admin:admin -d @tempfile.xml http://localhost:8810/rest/trigger

Promote build

Syntax

Build can be promoted by posting the promotion parameter xml to below url:

http://localhost:8810/rest/promote

A sample promotion parameter xml is like below:

<com.pmease.quickbuild.rest.PromoteParams>
  <!-- This element represents the destination configuration of the promotion process. -->
  <configurationId>5</configurationId>

  <!-- This element defines the promotion source, including id of the build to be promoted, 
       and the files to be promoted. The _files_ element is optional. -->
  <promotionSource>
    <buildId>100</buildId>
    <files>
      <com.pmease.quickbuild.rest.RetrieveFiles>
        <srcPath>artifacts</srcPath>
        <patterns>**</patterns>
      </com.pmease.quickbuild.rest.RetrieveFiles>
    </files>
  </promotionSource>

  <!-- This element is optional and can be used to specify variables for the promotion 
       process. -->
  <variables>
    <entry>
      <string>name1</string>
      <string>value1</string>
    </entry>
    <entry>
      <string>name2</string>
      <string>value2</string>
    </entry>
  </variables>
</com.pmease.quickbuild.rest.PromoteParams>

The response is of mime type text/plain and the content is string representation of newly generated build id as result of the promotion.

Security

You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have PROMOTE_BUILD permission for the destination configuration.

Demo

We use curl to demonstrate how to promote all artifacts of build with id 100 to configuration with id 2:

  1. Save the sample promotion param xml described above to file tempfile.xml.
  2. Post content of tempfile.xml to QuickBuild using below command:
    curl -X POST -u admin:admin -d @tempfile.xml http://localhost:8810/rest/promote

Update build

Syntax

Build can be updated by posting xml representation of the build to below url:

http://localhost:8810/rest/builds

Please note that the configuration element denotes id of the belonging configuration.
Normally you do not need to create the xml from scratch: you may retrieve xml representation of the build using the http GET method, modify certain parts of the xml and post back to above url.
The response is of mime type text/plain and the content is string representation of the build id being updated.

Security

You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.

Demo

We will use curl to demonstrate how to move the build to be under another configuration. Let's assume the build id is 100, and the destination configuration id is 6.

  1. Retrieve xml representation of desired build into a temp file using below command:
    curl -u admin:admin http://localhost:8810/rest/build?id=100 > tempfile.xml
  2. Edit tempfile.xml and change the configuration property to take the value 6.
  3. Post back modified content using below command:
    curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/build

Create build

Syntax

Build can be created by posting xml representation of the build to below url:

http://localhost:8810/rest/builds

Please note that:

  1. The posted xml should NOT contain the id element; otherwise, QuickBuild will treat the post as an updating to the build with that id.
  2. The configuration element denotes id of the belonging configuration.
    Normally you do not need to create the xml from scratch: you may retrieve xml representation of a templating build using the http GET method, remove the id element, modify certain parts and post back to above url.
    The response is of mime type text/plain and the content is string representation of id of the newly created build.

Security

You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.

Demo

We will use curl to demonstrate how to create a new build by copying an existing build with id 100.

  1. Retrieve xml representation of build with id 100 into a temp file using below command:
    curl -u admin:admin http://localhost:8810/rest/build?id=100 > tempfile.xml
  2. Edit tempfile.xml to remove the id element, and change other properties as desired.
  3. Post back modified content using below command:
    curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/build

Cancel build

Syntax

Build can be cancelled using http GET method through below url:

http://localhost:8810/rest/cancel?id=<build id>

Here <build id} stands for id of the build to be cancelled.

Security

You will need to use http BASIC authentication to login as authenticated QuickBuild user if the anonymous does not have STOP_BUILD permission on the belonging configuration.

Demo

Below curl command demonstrates how to cancel the build with id 100:

curl -X DELETE -u admin:admin http://localhost:8810/rest/canceld?id=100

Delete build

Syntax

Build can be deleted using http DELETE method through below url:

http://localhost:8810/rest/build?id=<build id>

Here <build id} stands for id of the build to be deleted.

Security

You will need to use http BASIC authentication to login as administrator if the anonymous does not have DELETE_BUILD permission on the belonging configuration.

Demo

Below curl command demonstrates how to delete the build with id 100:

curl -X DELETE -u admin:admin http://localhost:8810/rest/build?id=100

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.