jenkinsci / jenkinsci/checks-api-plugin
Include optional checks publisher to warnError
- Dominant language
- Java
- Stars
- 49
- Forks
- 32
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
The pattern I'd always intended to use with this (but never got round to implementing) was to add an optional checks publisher to `warnError`. For e.g. running tests you can do:
```groovy
withChecks('My Tests') {
sh 'run_tests > results.xml'
junit 'results.xml'
}
```
and that works fine; sometimes you have a one-shot command where you just want to report success or failure. It would be nice to extend `warnError` to be checks aware:
```groovy
withChecks('One Shot') {
warnError('One Shot') {
sh 'one_shot'
}
}
```
ie, have warnError report the appropriate success/failure message to the active checks context.
Alternatively get `warnError` to be fully responsible for doing the checks itself, so
```groovy
warnError(message: 'One Shot', publishChecks: true) {
sh 'one_shot'
}
```
Not sure why I never got round to doing it, but happy to take another look if people think it might be a useful pattern?
_Originally posted by @mrginglymus in https://github.com/jenkinsci/checks-api-plugin/issues/199#issuecomment-1303122026_
Contributor guide
Assessment
This issue has not been assessed yet.