Use Pipelines API

Updated 2 months ago by Archana Singh

This topic lists sample queries on how to use Pipeline APIs.

In this topic:

Before You Begin

Fetch Pipeline ID

Use this query to get pipelineId .

Request
query{pipelineByName(applicationId: "-XXXXqR6QIeXXXz-VuwIzA" pipelineName: "Test Pipeline"
) {
id
}}
Response
{
"data": {
"pipelineByName": {
"id": "XXyXrXusQSiK2P2M8wXXXX"
}
}
}

Show Details About a Pipeline

This example returns basic information about a specified Pipeline. It corresponds to a GET operation in a REST API.

Request
{
pipeline(pipelineId: "<pipelineId>") {
id
name
description
}
}
Response
{
"data": {
"pipeline": {
"id": "XXyUrJusQSiK2P2M8wXXXX",
"name": "Test Pipeline",
"description": null
}
}
}

Fetch a List of Pipelines

This example iterates through Pipelines—using specified limit and offsetvalues—to return basic details.

Request
{
pipelines(limit: 5, offset: 5) {
nodes {
id
name
description
createdAt
}
pageInfo {
total
}
}
}
Response
{
"data": {
"pipelines": {
"nodes": [
{
"id": "XXXXqR6QIeXXXz-VuwIXX",
"name": "Test Pipeline",
"description": null,
"createdAt": 1588243374775
},
{
"id": "XXiHq2XXXiHt5oKq0hXxx",
"name": "Generate Installer Only",
"description": null,
"createdAt": 1588215490568
},
{
"id": "XxxXXwFDQCa2FNtzCfxxxx",
"name": "admin portal qa deployment",
"description": null,
"createdAt": 1586314977682
},
{
"id": "6XxX4YZHRDaU4auEibiXXX",
"name": "Admin Portal dev Deployment",
"description": null,
"createdAt": 1586254024638
},
{
"id": "xxxXyXm4QlOg76a19Gev1g",
"name": "Stress Deployment",
"description": "Stress Deployment",
"createdAt": 1584571141143
}
],
"pageInfo": {
"total": 47
}
}
}
}

Show Pipelines for a Given Application

This sample queries by applicationId to return details about corresponding Pipelines.

{
pipelines(
filters: [
{ application: { operator: EQUALS, values: ["<ApplicationID>"] } }
]

limit: 5
offset: 2
) {
nodes {
id
name
description
createdAt
}
pageInfo {
total
}
}
}

Show Deployments for a Given Pipeline

This sample queries by pipelineId to return details on up to 5 deployments.

The Environment filter works only after the Workflow execution is completed.

For example, you have two Workflows in your Pipeline, WF1: ENV1 and WF2: ENV2. The ENV1 filter will work at the Pipeline level only after the WF1 has completed the execution.
{
executions(
filters: [{ pipeline: { operator: EQUALS, values: ["<pipelineId>"] } }]
limit: 5
) {
pageInfo {
total
}
nodes {
id
}
}
}
Example
{
executions(limit: 5, filters: [{
application: {
operator: EQUALS,
values: ["xXxxxU-YYaaabb1x"]
},
status: {
operator: NOT_IN,
values: ["SUCCESS", "FAILED"]
},
environment: {
operator: EQUALS,
values: "xxxyy1aa2xx-xxyyAA12aa"
}
}]) {
nodes {
application {
id
name
}
id
startedAt
status
}
}
}


How did we do?