Class EnvironmentScript

  • All Implemented Interfaces:
    ExtensionPoint, hudson.matrix.MatrixAggregatable, Describable<BuildWrapper>

    public class EnvironmentScript
    extends BuildWrapper
    implements hudson.matrix.MatrixAggregatable
    Runs a specific chunk of code before each build, parsing output for new environment variables.
    Author:
    Jørgen P. Tjernø, dawidmalina@gmail.com
    • Constructor Detail

      • EnvironmentScript

        @DataBoundConstructor
        public EnvironmentScript​(String script,
                                 String scriptType,
                                 boolean runOnlyOnParent,
                                 boolean hideEnvironmentVariablesValues)
    • Method Detail

      • getScript

        public String getScript()
        We'll use this from the "config.jelly".
      • getScriptType

        public String getScriptType()
        We will use this from the "config.jelly".
        Returns:
      • isRunOnlyOnParent

        public boolean isRunOnlyOnParent()
        Returns:
        Whether or not we only run this on the MatrixBuild parent, or on the individual MatrixRun s.
      • isHideEnvironmentVariablesValues

        public boolean isHideEnvironmentVariablesValues()
      • buildCommandLine

        public String[] buildCommandLine​(FilePath scriptFile)
      • createAggregator

        public hudson.matrix.MatrixAggregator createAggregator​(hudson.matrix.MatrixBuild build,
                                                               Launcher launcher,
                                                               BuildListener listener)
        Create an aggregator that will calculate the environment once if onlyRunOnParent is true. The aggregator we return is called on the parent job for matrix jobs. In it we generate the environment once and persist it in an Action (of type PersistedEnvironment) if the job has onlyRunOnParent enabled. The subjobs ("configuration runs") will retrieve this and apply it to their environment, without performing the calculation.
        Specified by:
        createAggregator in interface hudson.matrix.MatrixAggregatable