Integration Builds

Generating an Integration Build

Create/Update from running components

Generate an integration build with a specific build name based on all the components reporting on a specific labId All the components must be already deployed and reporting to Sealights at the time the API is called.

POST /sl-api/v1/agent-apis/lab-ids/{labId}/integration-build

As the components must be already deployed and reporting to Sealights at the time the API is called, you will not be able to use this for components like UI that come up in the browser only at the time the tests are actually run To work around this, you can either provide its details in the additionalComponents parameter, or open the UI programmatically just before calling the API

Request details

Request Parameters

Parameter
Description
Parameter Type
Data Type

labId

Lab Id

path

string

buildName

Build name

body

string

additionalComponents

additional components to be added to the integration build

body

array of { "bsid": "string", "appName": "string", "branchName": "string", "buildName": "string" }

forceFailedComponents

Force the creation of the integration build even when some of the components failed to be reported to Sealights during their build scan

body

boolean

Request Body

String containing the name of the build (buildName). This build must be a new build name, never reported for this integration build. additionalComponents Optional information that can be used to provide additional components not alive and reporting to Sealights at the time the API is called. forceFailedComponents Optional flag that can be used to force the creation of the integration build even when some of the components failed to be reported to Sealights during their build scan. It is important to understand that even though the integration build will be created, it will not be representing the correct deployment and coverage will not be captured for the components that did not report a complete build scan

Response Status Codes

Code
Status
Description

200

OK

Integration build created successfully

400

BAD REQUEST

Integration build name already exists or unresolved components

409

CONFLICT

No running agents were reported from lab

500

Internal server error

Request Samples

Sample HTTP Request and Response

POST /sl-api/v1/agent-apis/lab-ids/{labId}/integration-build HTTP/1.1
Authorization: Bearer {sealights-agent-token}
Accept: application/json
Content-Type: application/json

{
  "buildName": "{build-name}"
  "additionalComponents": [
    { "bsid": "123456789" },
    { "appName": "app1", "branchName": "master", "buildName": "1.1.99" }
  ]
}

HTTP/1.1 200 OK
Content-Type: application/json
{
  "buildSessionId": "integration-bsid"
}

HTTP/1.1 400 BAD REQUEST
HTTP/1.1 409 CONFLICT

Cockpit events

You can view events received by Sealights in the cockpit under the Lab Monitor. The type of events you can see are:

Event type
Type
Description

INTEGRATION_BUILD_CREATED

Info

Integration build created successfully

INTEGRATION_BUILD_MISSING_APPS

Info

Some apps that are already part of the integration build are not currently reporting

INTEGRATION_BUILD_ERROR_ALREADY_EXISTS

Error

Integration build name already exists. buildName must be unique for every new integration build

INTEGRATION_BUILD_ERROR_NO_LIVE_AGENTS

Error

Cannot create new integration build since no live agents detected for the given lab ID

INTEGRATION_BUILD_ERROR_FAILED_TO_CREATE

Error

Failed to create integration build. See description for more details

Spin up the UI programmatically

As mentioned above in the note, as the components must be already deployed and reporting to Sealights at the time the API is called, you will not be able to use this for components like UI that come up in the browser only at the time the tests are actually runTo work around this, you can either provide its details in the additionalComponents parameter, or open the UI programmatically just before calling the API.

Here is sample code to spin up the UI programmatically:

BUILD_ID=ignore_bk google-chrome --headless http://${ENV_URL}  --disable-gpu > chrome.log &
CHROME_PID=$!
sleep 30 # Gives time for the UI to come up and browser agent start reporting, update according to UI spinup time
curl -X POST "https://$DOMAIN/sl-api/v1/agent-apis/lab-ids/{labId}/integration-build" -H "Authorization: Bearer $SEALIGHTS_AGENT_TOKEN" -H "Content-Type: application/json" -d '{ "buildName": "build-name"}'
sleep 10
kill ${CHROME_PID}

Create/Update from an explicit list of components

Create/update integration build with a specific build session ID (bsid). If the requested bsid does not exist, create it. Otherwise, add components to it.

PUT /sl-api/v1/agent-apis/integration-builds/{bsid}/components

To delete components see Delete Integration Build's Components below.

Request details

Request Parameters

bsid

Build Session ID

Request Body

Array of build session IDs or component details (app name, branch name, build name). If both bsid and app-branch-build are supplied, app-branch-build are prioritized.

Response Status Codes

200

OK

Components successfully updated

409

CONFLICT

Some components are invalid

Request Samples

Sample HTTP request and response

DELETE /sl-api/v1/agent-apis/integration-builds/{bsid}/components HTTP/1.1
Authorization: Bearer {sealights-agent-token}
Content-Type: application/json
[
  {
    "bsid": "component-bsid",
    "appName": "app",
    "branchName": "branch",
    "buildName": "build"
  }
]
HTTP/1.1 200 OK
HTTP/1.1 409 CONFLICT

Automatic Integration Build Creation

You may configure an Integration labId to Automatically create Integration Builds. To do this you must:

Delete Integration Build's Components

Delete components from a specific integration build.

DELETE /sl-api/v1/agent-apis/integration-builds/{bsid}/components

Request Details

Request Parameters

Parameter
Description

bsid

Build Session ID

Request Body

Array of build session IDs or component details (app name, branch name, build name). If both bsid and app-branch-build are supplied, app-branch-build are prioritized.

Response Status Codes

Code
Status
Description

200

OK

Components successfully updated

409

CONFLICT

Some components are invalid

Request Samples

Sample HTTP request and response

DELETE /sl-api/v1/agent-apis/integration-builds/{bsid}/components HTTP/1.1
Authorization: Bearer {sealights-agent-token}
Content-Type: application/json
[
  {
    "bsid": "component-bsid",
    "appName": "app",
    "branchName": "branch",
    "buildName": "build"
  }
]
HTTP/1.1 200 OK
HTTP/1.1 409 CONFLICT

Attach Integration Build to a lab from Multiple environments

Attach integration build to a lab.

PUT /sl-api/v1/agent-apis/lab-ids/{labId}/integration-build

Request Details

Request Parameters

Parameter
Description
Required

labId

Lab Id

Required

Request Body

Parameter
Description
Required

buildName

Integration build name

Required one of buildName or bsid

bsid

Integration build session id

Required one of buildName or bsid

Response Status Codes

Code
Status
Description

204

OK

Components successfully updated

400

BAD REQUEST

One of the following reasons:

  • Missing parameter labId , bsid or buildName

  • LabID provided is not compatible. Attach is allowed only on multi labs

404

NOT FOUND

  • labId '{lab-id}' Not Found

  • There is no build '{build-name}' for lab '{lab-id}'

500

INTERNAL SERVER ERROR

Request Samples

Sample HTTP request and response

PUT /sl-api/v1/agent-apis/lab-ids/{labId}/integration-build HTTP/1.1
Authorization: Bearer {slagent-token}
Accept: application/json
Content-Type: application/json

{
  "buildName": "{build-name}"
}

HTTP/1.1 200 OK
HTTP/1.1 400 BAD REQUEST
HTTP/1.1 404 NOT FOUND
HTTP/1.1 500 INTERNAL SERVER ERROR

Create integration build lab

Integration build labs are normally created through the UI although they can be created also using the following API:

POST /sl-api/v1/agent-apis/lab-ids

Request details

Request Body

Parameter
Description
Required

appName

Application name

Required

branchName

Release or Environment name

Required

testEnv

If multiple test environments for the same deployment exist, they can be specified separately

labAlias

Alias name for the lab

cdOnly

If true, the integration build gets created automatically when tests are run against the lab

isHidden

Hide the build lab from the UI

Response Status Codes

201

OK

Response with labId

400

Bad request

Missing parameters

500

INTERNAL SERVER ERROR

Request Samples

Sample HTTP request and response

POST /sl-api/v1/agent-apis/lab-ids HTTP/1.1
Authorization: Bearer {sealights-agent-token}
Content-Type: application/json

{
    "appName": "My Product",
    "branchName": "qa",
}

HTTP/1.1 200 OK
HTTP/1.1 409 CONFLICT

Last updated

Was this helpful?