Skip to content

Include optional checks publisher to warnError #200

Description

@timja
    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:
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:

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

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 #199 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions