Skip to content

Commit cf7fbf2

Browse files
committed
Fix detection of zero failures
1 parent 9b0be93 commit cf7fbf2

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

hooks/command

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ docker \
3535

3636
cat "$annotation_path"
3737

38-
buildkite-agent artifact upload "$annotation_path"
39-
40-
if ! grep -q "There were no failures" "$annotation_path"; then
38+
if grep -q "<details>" "$annotation_path"; then
4139
echo "--- :buildkite: Creating annotation"
4240
# shellcheck disable=SC2002
4341
cat "$annotation_path" | buildkite-agent annotate --context junit --style error

tests/command.bats

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ load "$BATS_PATH/load.bash"
2020
stub buildkite-agent "artifact download junits/*.xml /plugin/tests/tmp//plugin/junit-artifacts : echo Downloaded artifacts" \
2121
"annotate --context junit --style error : echo Annotation added"
2222

23-
stub docker "--log-level error run --rm --volume /plugin/tests/tmp//plugin/junit-artifacts:/junits --volume /plugin/hooks/../ruby:/src --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN= ruby:2.5-alpine /src/bin/annotate /junits : echo ANNOTATION"
23+
stub docker "--log-level error run --rm --volume /plugin/tests/tmp//plugin/junit-artifacts:/junits --volume /plugin/hooks/../ruby:/src --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN= ruby:2.5-alpine /src/bin/annotate /junits : echo '<details>Failure</details>'"
2424

2525
run "$PWD/hooks/command"
2626

@@ -45,14 +45,12 @@ load "$BATS_PATH/load.bash"
4545

4646
stub buildkite-agent "artifact download junits/*.xml /plugin/tests/tmp//plugin/junit-artifacts : echo Downloaded artifacts"
4747

48-
stub docker "--log-level error run --rm --volume /plugin/tests/tmp//plugin/junit-artifacts:/junits --volume /plugin/hooks/../ruby:/src --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN= ruby:2.5-alpine /src/bin/annotate /junits : echo There were no failures"
48+
stub docker "--log-level error run --rm --volume /plugin/tests/tmp//plugin/junit-artifacts:/junits --volume /plugin/hooks/../ruby:/src --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN= ruby:2.5-alpine /src/bin/annotate /junits : echo No test errors"
4949

5050
run "$PWD/hooks/command"
5151

5252
assert_success
5353

54-
assert_output --partial "There were no failures"
55-
5654
unstub mktemp
5755
unstub buildkite-agent
5856
unstub docker

0 commit comments

Comments
 (0)