use of org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner in project workflow-cps-plugin by jenkinsci.
the class CpsScript method $build.
@CheckForNull
public Run<?, ?> $build() throws IOException {
FlowExecutionOwner owner = execution.getOwner();
Queue.Executable qe = owner.getExecutable();
if (qe instanceof Run) {
return (Run) qe;
} else {
return null;
}
}
use of org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner in project workflow-cps-plugin by jenkinsci.
the class RunningFlowActions method createFor.
@Override
public Collection<? extends Action> createFor(FlowExecutionOwner.Executable executable) {
FlowExecutionOwner owner = executable.asFlowExecutionOwner();
if (owner != null) {
FlowExecution exec = owner.getOrNull();
if (exec instanceof CpsFlowExecution && !exec.isComplete()) {
CpsFlowExecution e = (CpsFlowExecution) exec;
List<Action> actions = new ArrayList<>();
actions.add(new CpsThreadDumpAction(e));
// TODO cf. comment in CpsFlowExecution#pause
if (!(executable instanceof AccessControlled) || ((AccessControlled) executable).hasPermission(Item.CANCEL)) {
actions.add(new PauseUnpauseAction(e));
}
return actions;
}
}
return Collections.emptySet();
}
Aggregations