jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

How to get stage result or stage console output for a declarative pipeline?

Open solarjoe opened this issue 4 years ago • 1 comments

ISSUE TYPE
  • How to...
Jenkinsapi VERSION

0.3.11

Jenkins VERSION

2.190.1

SUMMARY

I would like to pass feedback from our (declarative) pipeline to the publisher of a pull request, especially if and maybe where the pipeline failed. Is there a way to access the stage result or stage console output.

You could parse this out of the console output, but maybe there is a better way.

solarjoe avatar Jul 08 '21 10:07 solarjoe

I think I found a solution.

The plugin Pipeline Stage View Plugin https://plugins.jenkins.io/pipeline-rest-api/ seems to be installed out-of-the-box for current Jenkins installations.

And it provides endpoints that are not used in jenkinsapi so far:

https://github.com/jenkinsci/pipeline-stage-view-plugin/tree/master/rest-api#get-jobjob-namewfapiruns

https://stackoverflow.com/a/38876067/7919597

solarjoe avatar Jul 09 '21 07:07 solarjoe