Stage log is one of my favorite features of Blue Ocean. But the inconsistent link to the stage log make me feel annoyed.
As a Jenkins share library maintainer, I want to get the url of stage log and put them in the report to make it easier for users to debug the issue.
I can get the correct stage ID in scripted pipeline, the problem is, if the stage is not in parallel block, it works well to access the log via stage ID. But if the stage is in parallel block then its log cannot be accessed by stage ID, but I have to find its parent parallel node's ID to access the log. It will throw the following error if you try to access it via the stage id:
{
"message" : "Stage 157 not found in pipeline my-pipeline",
"code" : 404,
"errors" : [ ]
}
I did some research myself and find it may have something to do with how blueocean render flow graph. (blueocean-pipeline-api-impl/src/main/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineNodeGraphVisitor.java)
I think a better way for doing this is to provide a general purpose rest API endpoint to allow users to access the stage log via stage id, which will make it more easier for the end user to use this awesome feature.