com.lookout.jenkins
Class EnvironmentScript

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<hudson.tasks.BuildWrapper>
      extended by hudson.tasks.BuildWrapper
          extended by com.lookout.jenkins.EnvironmentScript
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.matrix.MatrixAggregatable, hudson.model.Describable<hudson.tasks.BuildWrapper>

public class EnvironmentScript
extends hudson.tasks.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ø

Nested Class Summary
static class EnvironmentScript.DescriptorImpl
          Descriptor for EnvironmentScript.
 
Nested classes/interfaces inherited from class hudson.tasks.BuildWrapper
hudson.tasks.BuildWrapper.Environment
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
EnvironmentScript(String script, boolean onlyRunOnParent)
           
 
Method Summary
 String[] buildCommandLine(hudson.FilePath scriptFile)
           
 hudson.matrix.MatrixAggregator createAggregator(hudson.matrix.MatrixBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          Create an aggregator that will calculate the environment once iff onlyRunOnParent is true.
 String getScript()
          We'll use this from the config.jelly.
 hudson.tasks.BuildWrapper.Environment setUp(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
           
 boolean shouldOnlyRunOnParent()
           
 
Methods inherited from class hudson.tasks.BuildWrapper
all, decorateLauncher, decorateLogger, getProjectAction, getProjectActions, makeBuildVariables, makeSensitiveBuildVariables, preCheckout, setUp
 
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentScript

@DataBoundConstructor
public EnvironmentScript(String script,
                                              boolean onlyRunOnParent)
Method Detail

getScript

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


shouldOnlyRunOnParent

public boolean shouldOnlyRunOnParent()

setUp

public hudson.tasks.BuildWrapper.Environment setUp(hudson.model.AbstractBuild build,
                                                   hudson.Launcher launcher,
                                                   hudson.model.BuildListener listener)
                                            throws IOException,
                                                   InterruptedException
Overrides:
setUp in class hudson.tasks.BuildWrapper
Throws:
IOException
InterruptedException

buildCommandLine

public String[] buildCommandLine(hudson.FilePath scriptFile)

createAggregator

public hudson.matrix.MatrixAggregator createAggregator(hudson.matrix.MatrixBuild build,
                                                       hudson.Launcher launcher,
                                                       hudson.model.BuildListener listener)
Create an aggregator that will calculate the environment once iff 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


Copyright © 2004-2012. All Rights Reserved.