Class CpsScript

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
com.cloudbees.groovy.cps.SerializableScript
org.jenkinsci.plugins.workflow.cps.CpsScript
All Implemented Interfaces:
groovy.lang.GroovyObject, Serializable

public abstract class CpsScript extends SerializableScript
The script of a workflow. Every Script we load in Pipeline execution derives from this subtype.
Author:
Kohsuke Kawaguchi
See Also:
  • Constructor Details

  • Method Details

    • invokeMethod

      public final Object invokeMethod(String name, Object args)
      We use DSL here to try invoke the step implementation, if there is Step implementation found it's handled or it's an error.

      sandbox security execution relies on the assumption that CpsScript.invokeMethod() is safe for sandboxed code. That means we cannot let user-written script override this method, hence the final.

      Specified by:
      invokeMethod in interface groovy.lang.GroovyObject
      Overrides:
      invokeMethod in class groovy.lang.Script
    • getProperty

      public Object getProperty(String property)
      Specified by:
      getProperty in interface groovy.lang.GroovyObject
      Overrides:
      getProperty in class groovy.lang.Script
    • $build

      @CheckForNull public Run<?,?> $build() throws IOException
      Throws:
      IOException
    • $buildNoException

      @CheckForNull public Run<?,?> $buildNoException()
    • evaluate

      public Object evaluate(String script) throws org.codehaus.groovy.control.CompilationFailedException
      Overrides:
      evaluate in class groovy.lang.Script
      Throws:
      org.codehaus.groovy.control.CompilationFailedException
    • evaluate

      public Object evaluate(File file) throws org.codehaus.groovy.control.CompilationFailedException, IOException
      Overrides:
      evaluate in class groovy.lang.Script
      Throws:
      org.codehaus.groovy.control.CompilationFailedException
      IOException
    • run

      public void run(File file, String[] arguments) throws org.codehaus.groovy.control.CompilationFailedException, IOException
      Overrides:
      run in class groovy.lang.Script
      Throws:
      org.codehaus.groovy.control.CompilationFailedException
      IOException
    • readResolve

      protected Object readResolve()
    • println

      public void println()
      Overrides:
      println in class groovy.lang.Script
    • print

      public void print(Object value)
      Overrides:
      print in class groovy.lang.Script
    • println

      public void println(Object value)
      Overrides:
      println in class groovy.lang.Script
    • printf

      public void printf(String format, Object value)
      Overrides:
      printf in class groovy.lang.Script
    • printf

      public void printf(String format, Object[] values)
      Overrides:
      printf in class groovy.lang.Script
    • sleep

      public Object sleep(long arg)
      Effectively overrides DefaultGroovyStaticMethods.sleep(Object, long) so that SleepStep works even in the bare form sleep 5.
      See Also: