@Override public void print(Object value) { // TODO: handling 'print' correctly requires collapsing multiple adjacent print calls into one Step. println(value); }
@Nonnull @Override public Object getValue(@Nonnull CpsScript script) throws Exception { Binding binding = script.getBinding(); script.println(); Object openshift; if (binding.hasVariable(getName())) { openshift = binding.getVariable(getName()); } else { // Note that if this were a method rather than a constructor, we // would need to mark it @NonCPS lest it throw // CpsCallableInvocation. openshift = script.getClass().getClassLoader() .loadClass("com.openshift.jenkins.plugins.OpenShiftDSL") .getConstructor(CpsScript.class).newInstance(script); binding.setVariable(getName(), openshift); } return openshift; } }