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
43 stars 28 forks source link

Only return names in getStageOrBranchName if it's a stage or branch #253

Closed thatsmydoing closed 8 months ago

thatsmydoing commented 8 months ago

If stageOrBranchName is present, we skip processing errors. This is on the assumption that if stageOrBranchName is present it is a stage or branch. However, normal steps like sh can have labels too and was returned as the stageOrBranchName. This causes labeled steps to not have their errors processed.

We fix this by returning empty in getStageOrBranchName if the node is not a BlockStartNode.

This fixes https://github.com/jenkinsci/checks-api-plugin/issues/252

Testing done

I've tested this on a private Jenkins instance. As far as I can tell, it works as expected. This has no pre-existing tests and I'm honestly not sure how to write them.

Submitter checklist