Skip to content

Commit

Permalink
refactor: more jq and more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg O'Grady committed Nov 13, 2024
1 parent b9a75a2 commit 4fb997e
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions src/jobs/e2e/collect-e2e-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,33 @@ steps:
- run:
name: Wait for smoke test jobs to complete
command: |
# Loop through to check if each of the jobs have been completed
for job in $(echo "<< parameters.smoke-test-jobs >>" | tr "," "\n"); do
while [[ $(curl --location --request GET "https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/job" --header "Circle-Token: $CIRCLE_TOKEN"| jq -r ".items[]|select(.name == \"$job\")|.status" | grep -c "running") -gt 0 ]]
do
sleep 5
done
FILTER=$(cat \<<EOF
(\$jobstr | split(",")) as \$jobs |
.items
| map(
select(
.name as \$name |
\$jobs | index(\$name)
)
| { name, status }
)
EOF
)
while [[ $(
curl "https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/job" \
--location \
--request GET \
--header "Circle-Token: $CIRCLE_TOKEN" \
| jq -r --arg jobstr "<< parameters.smoke-test-jobs >>" "$FILTER" \
| tee -a job-status.log \
| jq -r 'map(select(.status == "running")) | length'
) -gt 0 ]]; do
sleep 5
done
cat job-status.log
- run: echo "All required jobs have now completed"
- run:
name: Gather Kubernetes state after run
Expand Down

0 comments on commit 4fb997e

Please sign in to comment.