Skip to content

Commit 6a97ddc

Browse files
authored
Be resilient to broken circle test results.json (apache-spark-on-k8s#370)
1 parent b3fb144 commit 6a97ddc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.circleci/config.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,20 @@ jobs:
355355
356356
# Otherwise, combine the two, preferring newer results from circle test results
357357
echo "Found both cached and circle test results, merging"
358-
jq -s 'def meld:
358+
if jq -s 'def meld:
359359
reduce .[] as $o
360360
({}; reduce ($o|keys)[] as $key (.; .[$key] += [$o[$key]] ));
361361
def grp: map([{key: "\(.source)~\(.classname)", value: .}] | from_entries) | meld;
362362
((.[0].tests | grp) * (.[1].tests | grp)) | map(values) | flatten | {tests: .}' \
363363
"$TEST_RESULTS_FILE" \
364-
"$CIRCLE_INTERNAL_TASK_DATA/circle-test-results/results.json" \
364+
"$CIRCLE_TEST_RESULTS_FILE" \
365365
> /tmp/new-test-results.json
366-
# Overwrite the previously cached results with the merged file
367-
mv -f /tmp/new-test-results.json "$TEST_RESULTS_FILE"
366+
then
367+
# Overwrite the previously cached results with the merged file
368+
mv -f /tmp/new-test-results.json "$TEST_RESULTS_FILE"
369+
else
370+
echo "Failed to merge test results, probably $CIRCLE_TEST_RESULTS_FILE didn't have the expected structure - ignoring it"
371+
fi
368372
- save_cache:
369373
key: v1-test-results-{{ .Branch }}-{{ .BuildNum }}
370374
paths:

0 commit comments

Comments
 (0)