[pipeline] Retrieve builds triggered by the 'build' step after builds are finalized

24 views
Skip to first unread message

Luigi Lentini

unread,
Sep 6, 2016, 7:59:40 AM9/6/16
to Jenkins Developers

Hi,


I am using a Pipeline job to trigger several freestyle jobs during its execution, using the native 'build' step.


Later, after all the runs are finalized, I'd like to read info about those runs (name, number, duration, timestamp...) to collect metrics/stats regarding the overall runs. I'm using the Groovy Event Listener plugin for that task.


Now, I was thinking to read the WorkflowRun object's actions (looking for BuildTriggerAction instances) to get the downstream builds, but they are not available.


run.getActions(BuildTriggerAction.class) returns an empty list.

I've seen indeed that action is removed every time the triggered build is completed, as described in this ticket
https://issues.jenkins-ci.org/browse/JENKINS-28673


My questions are:

  • do you know how to retrieve the handle to the triggered builds in another way? Not at runtime (I don't have the RunWrapper object, but the WorkflowRun instead). Maybe using the flow objects?
  • is there another way to fix the issues seen in the ticket, instead of removing the BuildTriggerAction actions?

Thanks in advance!

Reply all
Reply to author
Forward
0 new messages