Skip to main content

Send verifications for quality gates

Learn how to use the CI/CD Manager API to send verifications for your quality gates.

All sample requests in this guide include the following path parameters:

Parameter nameDescription
tenantIdTenant ID.
starSystemIdID of the logical star system that includes the InsuranceSuite application for which you configure quality gates and send verifications.
applicationIdInsuranceSuite application which includes the build. For example:
- PC for PolicyCenter
- BC for BillingCenter
- CC for ClaimCenter
- CM for ContactManager
qualityGateIDID of a quality gate.

note

Before you can send verifications, you need to configure quality gates. For details, see Add-your-own testing in Guidewire Cloud Platform documentation.


Add a verification

To add a verification to your quality gate, send the following POST request:

curl -X 'POST' \
{baseUrl}/api/v3/tenants/{tenantId}/starsystems/{starSystemId}/applications/{applicationId}/quality-gates/{qualityGateId}/verifications
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'
-d '{body}'

Where {body} is a JSON object that represent a verification.

Example request body
{
"artifact": {
"type": "COMMIT",
"id": "4c7bb440aa8b6bd4ac744ceca9e50ac92355b79b"
},
"status": "FAILED",
"url": "https://bitbucket.example.com/browse/TEST-0000",
"comment": "Verification failed due to the following test suites failing: ..."
}

Get a list of all verifications

To list all the verifications for your quality gates, send the following GET request:

curl -X 'GET' \
{baseUrl}/api/v3/tenants/{tenantId}/starsystems/{starSystemId}/applications/{applicationId}/verifications
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'

A response contains a JSON object representing a list of all your quality gate verifications. Note, that you get only the latest verification for each quality gate.

Example response body
[
{
"status": "SUCCESSFUL",
"artifact": {
"type": "COMMIT",
"id": "4c7bb440aa8b6bd4ac744ceca9e50ac92355b79b"
},
"qualityGate": {
"id": "custom_smoke_test",
"name": "Custom Smoke Test",
"stage": "PRE_MERGE",
"required": true,
"description": "This Quality Gate verifies that an additional custom smoke test suite was run before merging to the main branch.",
"branchFilter": {
"filter": "refs/heads/master",
"type": "BRANCH_NAME"
}
},
"url": "https://bitbucket.example.com/browse/TEST-0000",
"comment": "Verification passed."
},
{
"status": "FAILED",
"artifact": {
"type": "COMMIT",
"id": "4c7bb440aa8b6bd4ac744ceca9e50ac92355b79b"
},
"qualityGate": {
"id": "bc_static_check",
"name": "BC Static Check",
"stage": "PRE_MERGE",
"required": true,
"description": "This Quality Gate verifies that an additional static analysis check was run before merging any changes.",
"branchFilter": null
},
"url": "https://bitbucket.example.com/browse/TEST-0000",
"comment": "Static check failed."
}
]

You can additionally narrow down the results by using the following query parameters:

  • stage - stage to which the quality gate applies (PRE_MERGE, PRE_PROMOTION_PREPROD or PRE_PROMOTION_PROD).
  • qualityGateId - ID of the related quality gate.
  • artifactType - COMMIT or BUILD.
  • artifactId - corresponding commit hash or build ID.
  • status- status of the verification (SUCCESSFUL, FAILED or PENDING).

For example, to list all the successful verifications for quality gates with PRE_MERGE stage, send the following GET request:

curl -X 'GET' \
{baseUrl}/api/v3/tenants/{tenantId}/starsystems/{starSystemId}/applications/{applicationId}/verifications?stage=PRE_MERGE&status=SUCCESSFUL
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'

Get verification details

To get the details of the latest verification for a given quality gate, send the following GET request:

curl -X 'GET' \
{baseUrl}/api/v3/tenants/{tenantId}/starsystems/{starSystemId}/applications/{applicationId}/quality-gates/{qualityGateId}/verifications?artifactId={artifactId}&artifactType={artifactType}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'

Where you can use the following query parameters:

  • artifactId - corresponding commit hash or build ID.
  • artifactType - COMMIT or BUILD.

For example, to get the latest verification for a quality gate with ID custom_smoke_test that applies to a commit with the following hash: 4c7bb440aa8b6bd4ac744ceca9e50ac92355b79b, send a request as follows:

curl -X 'GET' \
{baseUrl}/api/v3/tenants/{tenantId}/starsystems/{starSystemId}/applications/{applicationId}/quality-gates/custom_smoke_test/verifications?artifactId=4c7bb440aa8b6bd4ac744ceca9e50ac92355b79b&artifactType=COMMIT' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'

A response contains a JSON object with the details of the verification:

Example response body
{
"status": "SUCCESSFUL",
"artifact": {
"type": "COMMIT",
"id": "4c7bb440aa8b6bd4ac744ceca9e50ac92355b79b"
},
"qualityGate": {
"id": "custom_smoke_test",
"name": "Custom Smoke Test",
"stage": "PRE_MERGE",
"required": true,
"description": "This Quality Gate verifies that an additional custom smoke test suite was run before merging to the main branch.",
"branchFilter": {
"filter": "refs/heads/master",
"type": "BRANCH_NAME"
}
},
"url": "https://bitbucket.example.com/browse/TEST-0000",
"comment": "Verification passed."
}

Delete a verification

You don't need to delete a verification as you can override it by sending a new verification. In some cases, however, you might want to delete an existing verification, for example, when you posted it by mistake. In that case, send the following DELETE request without any request body:

curl -X 'DELETE' \
{baseUrl}/api/v3/tenants/{tenantId}/starsystems/{starSystemId}/applications/{applicationId}/quality-gates/{qualityGateId}/verifications?artifactId={artifactId}&artifactType={artifactType}' \
-H 'Authorization: Bearer {access_token}'

You'll receive a response with HTTP code 204 and without any response body.