Dear All,
I am trying to write a System Groovy script to print a list of all my previous pipeline runs with their respective total time and status. For the status, I need to consider that the whole pipeline failed if any of the jobs involved failed.
So far, I managed to write the following:
import se.diabol.jenkins.pipeline.DeliveryPipelineView
import se.diabol.jenkins.pipeline.domain.Component
import se.diabol.jenkins.pipeline.domain.Pipeline
import se.diabol.jenkins.pipeline.domain.status.StatusType
pipelineView = Jenkins.activeInstance.getView('essentials-master-pipeline')
pipelineView.getPipelines().collectMany { comp ->
comp.getPipelines().collect { pipeline ->
[cn: comp.componentNumber, timeStamp: pipeline.timestamp, totalBuildTime: pipeline.totalBuildTime,
buildName: pipeline.version, triggeredBy: pipeline.triggeredBy.description,
success: pipeline.allTasks.values.any { it.status != StatusTyep.SUCCESS } ]
}
}
However, this only gives me access to the pipeline runs on the first page.
I've been reading the source code, but I still couldn't understand what would be the best way to gain access to a complete list of all the previous pipeline executions.
Any help would be very welcome.