Interact with Build Requests

Build request object can be used to request new build or cancel running build.

Request new build

Syntax

New build can be requested by posting XML representation of the build request object to below url:

http://localhost:8810/rest/build_requests

A sample XML of build request object is like below:

<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>

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

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 request a build in configuration root/test:

  1. Get configuration id using id service:
    curl http://localhost:8810/rest/ids?configuration_path=root/test
  2. Save the sample build request XML described above to file tempfile.xml, and modify configuration id to use value returned by the first step.
  3. Post content of tempfile.xml to QuickBuild using below command:
    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/build_requests

Delete a Build Request

Syntax

Existing build request can be deleted using http DELETE method through below url:

http://localhost:8810/rest/build_requests/<build request id>
If a build is generated and running by the build request, the build will be forcibly stopped.

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.

Demo

We use curl to demonstrate how to delete build request 0136ed89-d47f-4307-8e69-c8535fae0e84:

curl -X DELETE -u admin:admin http://localhost:8810/rest/build_requests/0136ed89-d47f-4307-8e69-c8535fae0e84

Labels:

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