github-integration-plugin icon indicating copy to clipboard operation
github-integration-plugin copied to clipboard

githubPRComment on failure

Open bra-fsn opened this issue 6 years ago • 5 comments

I would like to publish a comment on a PR builder with a job DSL config similar to this:

publishers {
    githubPRComment {
      comment {content('PR builder ${BUILD_NUMBER} ${BUILD_STATUS}')}
      statusVerifier {buildStatus("FAILURE")}
      errorHandler {buildStatus("UNSTABLE")}
    }
  }

My problem is that statusVerifier check for "better than or equal", which means this will fire every time the build is ran, but I only want to send a comment on failure. Is it possible to do this?

bra-fsn avatar Mar 29 '19 15:03 bra-fsn

Build statuses has numerics https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Result.java#L57-L80 try change criteria

KostyaSha avatar Mar 29 '19 16:03 KostyaSha

Yes, that's my problem as the check is <=, which means if I write success it will run only on success, but if I write anything bigger, all of them will match (including success). I would either need exact matching (run only with a given status), or at least the opposite. (>= Check, so a success would mean all statuses, failure would mean anything above failure)

bra-fsn avatar Mar 29 '19 18:03 bra-fsn

So how could I do this? Could you please make a verifier which makes it possible to do a comment if the build is failing?

bra-fsn avatar Apr 04 '19 17:04 bra-fsn

maybe additional status verified need to be developed...

KostyaSha avatar Apr 24 '19 10:04 KostyaSha

Could you do that, please?

bra-fsn avatar Apr 24 '19 11:04 bra-fsn