Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Interact with configuration for 3rd party script #4264

nini10 ·

Hi,

I want to interact with QB configuration from test script. The script will trigger QB configuration and wait until it will finish and according the results it continues it logic.

In more details, the required flow is:

  • Request a new build. I guess in this moment, there is not build id while it still in the queue. So, how to get it?
  • Wait until the build will be done. How is it possible to do it, and is it possible to know the build status (pass, fail)?
  • Get build artifacts? When the build done it publish results files, how the script could download them?

Could someone guide me how to do it? (example code will be the best)

Thanks

  • replies 5
  • views 1658
  • stars 0
robinshen ADMIN ·

Please check TriggerBuildStep in QB source. When a server is specified, it will trigger build on specified server via restful API, and wait until build finished. To get artifacts afterwards, you may issue a http GET request against the artifact url (will be displayed from UI) with appropriate credentials via BASIC authentication.

nini10 ·

Hi,

I'm not sure I understand what do you mean you.
What does it mean - "Please check TriggerBuildStep in QB source."? Can you please provide example code how to do it?

In addition, I thought using trigger restful API, but when I executed following line:
curl -u admin:admin "http://localhost:8810/rest/trigger?configuration_id=999"

I got following output:

<?xml version="1.0" encoding="UTF-8"?>

<com.pmease.quickbuild.RequestResult>
  <requestId>0a060632-d928-4d10-ad97-eb80e7f895d7</requestId>
  <loopedRequest>false</loopedRequest>
</com.pmease.quickbuild.RequestResult>

If this is the right way, how I can know what is the buildId from ?
If thus is not the right way, what is the alternative?

Thanks!

robinshen ADMIN ·

The TriggerBuildStep source I mentioned contains the logic you want, it uses RESTful API to trigger build on a remote QB server, getting the request id, and then poll remote server periodically until a build id is available, and then poll server again to wait for build finishing.

nini10 ·

Hi,

How it is possible to pull remote server until build id it available, if build id doesn't know?

For each trigger new build, following xml received:

curl -u admin:admin "http://localhost:8810/rest/latest_builds/238"
<?xml version="1.0" encoding="UTF-8"?>

<com.pmease.quickbuild.model.Build>
  <id>69378</id>
  <configuration>238</configuration>
  <version>1.0.22</version>
  <scheduled>false</scheduled>
  <status>FAILED</status>
  <statusDate>2020-08-02T11:02:47.017Z</statusDate>
  <beginDate>2020-08-02T11:00:24.745Z</beginDate>
  <duration>142268</duration>
  <stepRuntimes/>
  <repositoryRuntimes/>
  <secretAwareVariableValues/>
</com.pmease.quickbuild.model.Build>

And then when run rest api to get all build requests, got list of all builds in queue, as following. Request id shown in “ ” element but build-id is not present. So, how to know what is the build-id?

curl -u admin:admin "http://localhost:8810/rest/build_requests?configuration_id=238"
<?xml version="1.0" encoding="UTF-8"?>

<list>
  <com.pmease.quickbuild.BuildRequest>
    <configurationId>238</configurationId>
    <respectBuildCondition>false</respectBuildCondition>
    <variables/>
    <upstreamRequestIds/>
    <id>2d72d6c6-5140-4db4-9211-2dd6cdcee75a</id>
    <priority>5</priority>
    <requestDate>2020-08-02T11:42:47.199Z</requestDate>
    <requesterId>1</requesterId>
    <scheduled>false</scheduled>
    <status>RUNNING_BUILD</status>
  </com.pmease.quickbuild.BuildRequest>
  <com.pmease.quickbuild.BuildRequest>
    <configurationId>238</configurationId>
    <respectBuildCondition>false</respectBuildCondition>
    <variables/>
    <upstreamRequestIds/>
    <id>6ab142ba-84ef-446f-9ebd-a39a3a8ea397</id>
    <priority>5</priority>
    <requestDate>2020-08-02T11:42:48.777Z</requestDate>
    <requesterId>1</requesterId>
    <scheduled>false</scheduled>
    <status>WAITING_PROCESS</status>
  </com.pmease.quickbuild.BuildRequest>
  <com.pmease.quickbuild.BuildRequest>
    <configurationId>238</configurationId>
    <respectBuildCondition>false</respectBuildCondition>
    <variables/>
    <upstreamRequestIds/>
    <id>98c63908-a05f-4ce8-b6f6-94a16dbc1ca6</id>
    <priority>5</priority>
    <requestDate>2020-08-02T11:43:00.734Z</requestDate>
    <requesterId>2</requesterId>
    <scheduled>false</scheduled>
    <status>WAITING_PROCESS</status>
  </com.pmease.quickbuild.BuildRequest>
</list>

Thanks!

robinshen ADMIN ·