jenkinsci / checks-api-plugin

Jenkins plugin that defines an API for Jenkins to publish checks to SCM platforms.
https://plugins.jenkins.io/checks-api/
MIT License
42 stars 28 forks source link

Steps with labels are not logged as errors #252

Closed thatsmydoing closed 6 months ago

thatsmydoing commented 6 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.440.1 OS: Linux - 5.10.198-187.748.amzn2.x86_64 Java: 17.0.10 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- ... checks-api:2.0.2 ... ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Docker image for the controller and linux and macos agents

Reproduction steps

  1. Setup a github multibranch project and github checks
  2. Add a Jenkinsfile with
    sh(label: "Test", script: "false")
  3. Create a PR for Jenkins to build

Expected Results

The Jenkins checks result should show that the sh step had an error in the summary and also indicate an error in the details (text)

Actual Results

No error is shown in the summary and the details lists the step without an error.

Anything else?

I think the problem is in https://github.com/jenkinsci/checks-api-plugin/blob/09a2925b40638ec4d01ea9009924b8f9725e5ffb/src/main/java/io/jenkins/plugins/checks/status/FlowExecutionAnalyzer.java#L167-L168

It should probably prioritize the error check even if it has a name.

Are you interested in contributing a fix?

I'd be willing to make a PR, but I'm not sure about the original intentions of the code.

timja commented 6 months ago

PR welcome and yes error should probably be first