My first attempt was to define
class FlowExecutionList {
public Iterable<FlowExecutionOwner> getOwners() {}
}
class FlowExecutionOwner {
public @Nonnull ListenableFuture<FlowExecution> getPromise() {}
}
and to call these things from InputAction.onLoad, using Futures.addCallback to nest asynchronous stuff. This failed with a StackOverflowError in spite of WorkflowRun.LOADING_RUNS:
at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:470)
at hudson.model.RunMap.retrieve(RunMap.java:224)
at hudson.model.RunMap.retrieve(RunMap.java:56)
at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:479)
at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:461)
at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:367)
at hudson.model.RunMap.getById(RunMap.java:204)
at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.run(WorkflowRun.java:723)
at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.getExecutable(WorkflowRun.java:773)
at org.jenkinsci.plugins.workflow.support.steps.input.InputAction.onLoad(InputAction.java:57)
at hudson.model.Run.onLoad(Run.java:346)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:470)
My second attempt was to call loadExecutions in a background thread from onLoaded, in the hope that it would complete before we try to use executions. This sporadically failed, as it seems to have gotten a CpsFlowExecution on which onLoad had not yet been called.
Code changed in jenkins
User: Jesse Glick
Path:
src/main/java/org/jenkinsci/plugins/workflow/support/steps/input/InputAction.java
http://jenkins-ci.org/commit/pipeline-input-step-plugin/6efdc1fd5c8abd4daa840f4bc938d901e80cabdd
Log:
Noting
JENKINS-37154.