The below query will help us get the details such as :
If the execution was ExecutedByUser or ExecutedByTrigger
The PipelineExecution with the details such as pipeline id, name and member executions which is the WorkflowExecution with workflow id , name and details of the artifacts such as build number, artifact source.
Under the executions function , we will specify the startTime and endTime values in epoch.
The below has a limit of 30 who can change to the specified number you want.
Reference : https://docs.harness.io/article/tm0w6rruqv-harness-api
You can also explore the Docs section in our Harness API explorer UI.
QUERY :
{
executions(filters:[{startTime:{operator:AFTER, value:1643285847000}},{endTime:{operator:BEFORE,value:1656332247000}}], limit:30) {
pageInfo {
limit
offset
total
}
nodes {
startedAt
endedAt
tags {
name
value
}
id
application {
id
name
}
status
cause {
... on ExecutedByUser {
user {
email
}
}
... on ExecutedByTrigger {
trigger {
id
name
}
}
}
... on PipelineExecution {
pipeline {
id
name
}
memberExecutions{
nodes{
... on WorkflowExecution{
workflow{
id
name
}
id
artifacts {
buildNo
artifactSource {
name
}
}
outcomes{
nodes{
... on DeploymentOutcome{
service{
id
name
}
environment{
id
name
}
}
}
}
}
}
}
}
... on WorkflowExecution {
workflow {
id
name
}
id
artifacts {
buildNo
artifactSource {
name
}
}
outcomes{
nodes{
... on DeploymentOutcome{
service{
id
name
}
environment{
id
name
}
}
}
}
}
}
}
}
Sample output :
{
"startedAt": 1655373912604,
"endedAt": 1655373921637,
"tags": [],
"id": "YxxxxxxxxxxxxxRgINA",
"application": {
"id": "ivxxxxxxxxxxxx1kdDpQ",
"name": "Onboarding Test App"
},
"status": "SUCCESS",
"cause": {
"user": {
"email": "abc@harness.io"
}
},
"workflow": {
"id": "KJxxxxxxxxxxktLv2K6w",
"name": "Workflow-2"
},
"artifacts": [
{
"buildNo": "stable",
"artifactSource": {
"name": "Docker NGINX"
}
}
],
"outcomes": {
"nodes": [
{
"service": {
"id": "bJxxxxxxxxxxxxxxNB6VA",
"name": "Service-2"
},
"environment": {
"id": "s1pTbxxxxxxxxxxxxoZw",
"name": "Dev"
}
}
]
}
}
]
}
{
"startedAt": 1655379630417,
"endedAt": 1655379630496,
"tags": [],
"id": "Adxxxxxxxxxxxxxkw",
"application": {
"id": "ivsxxxxxxxxxxxDpQ",
"name": "Onboarding Test App"
},
"status": "FAILED",
"cause": {
"user": {
"email": "abc@harness.io"
}
},
"pipeline": {
"id": "Mxxxxxxxxxxxxzsg",
"name": "New PP"
},
"memberExecutions": {
"nodes": []
}
}