use of org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException in project workflow-cps-plugin by jenkinsci.
the class LoadStepExecution method start.
@Override
public boolean start() throws Exception {
CpsStepContext cps = (CpsStepContext) getContext();
CpsThread t = CpsThread.current();
CpsFlowExecution execution = t.getExecution();
String text = cwd.child(step.getPath()).readToString();
String clazz = execution.getNextScriptName(step.getPath());
String newText = ReplayAction.replace(execution, clazz);
if (newText != null) {
listener.getLogger().println("Replacing Groovy text with edited version");
text = newText;
}
Script script;
try {
script = execution.getShell().parse(text);
} catch (MultipleCompilationErrorsException e) {
// Convert to a serializable exception, see JENKINS-40109.
throw new CpsCompilationErrorsException(e);
}
// execute body as another thread that shares the same head as this thread
// as the body can pause.
cps.newBodyInvoker(t.getGroup().export(script), true).withDisplayName(step.getPath()).withCallback(BodyExecutionCallback.wrap(cps)).start();
return false;
}
Aggregations