buildkite / buildkite/rspec-junit-example
All tests passing causes annotate to fail to build
- Dominant language
- Ruby
- Stars
- 12
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
If all tests pass, this occurs:
```
2017-07-10 18:00:17 INFO Reading annotation body from STDIN
--
| 2017-07-10 18:00:18 FATAL Failed to annotate build: POST https://agent.buildkite.com/v3/jobs/00cfa11a-e0fc-42b5-94fc-83d42aaff7d1/annotations: 400 An annotation body is required
```
The reason why is `junit.rb` exists if `all_failures` is empty, and doesn't write to STDOUT.
A good fix would be to change `junit.sh` to check if `annotation.md` has any text, and then show either a success annotation with a message like "All tests pass", otherwise show the error annotation. That would look like this:
```echo "--- :buildkite: Creating annotation"
if [ `cat tmp/annotation.md | wc -l` -eq 0 ] ; then
buildkite-agent annotate --context junit --style success "All tests pass! :+1:"
else
buildkite-agent annotate --context junit --style error < tmp/annotation.md
fi
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with junit.sh and the annotation output produced by junit.rb in tmp/annotation.md. Run the pipeline with all tests passing and inspect the buildkite-agent annotation behavior, then verify that a successful annotation appears for an empty file while failure output still produces the error annotation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, shell
- Domain
- ci-cd, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100