I am trying to parse CircleCI
job json to see if ALL of the jobs are in successful state or not. If they are, then do something else keep waiting.
I was using this shell command in circleci job to see if any job failed to exit earlier
is_failed=$(echo $json | jq '.items | map(select(.name | contains("my-custom-job") | not)) | any(.status == "failed")')
Now I want to check if ALL the jobs has success
status, if so then do something else. How can i do that in shell script?
Here is link to CirclCI api (apparently the status
doesn't have enum, it could be null etc).
Update: Sample Json
{
"next_page_token": null,
"items": [
{
"started_at": "2021-04-01T14:50:43Z",
"name": "...",
"type": "build",
"status": "running"
},
{
"started_at": null,
"name": "...",
"type": "build",
"status": "blocked"
},
{
"started_at": null,
"name": "...",
"type": "build",
"status": "blocked"
},
{
"started_at": "2021-04-01T14:50:43Z",
"name": "auto-cancel",
"type": "build",
"status": "running"
}
]
}