Package com.lookout.jenkins
Class EnvironmentScript
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<BuildWrapper>
-
- hudson.tasks.BuildWrapper
-
- com.lookout.jenkins.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEnvironmentScript.EnvironmentScriptDescriptorDescriptor forEnvironmentScript.-
Nested classes/interfaces inherited from class hudson.tasks.BuildWrapper
BuildWrapper.Environment
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description EnvironmentScript(String script, String scriptType, boolean runOnlyOnParent, boolean hideEnvironmentVariablesValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]buildCommandLine(FilePath scriptFile)hudson.matrix.MatrixAggregatorcreateAggregator(hudson.matrix.MatrixBuild build, Launcher launcher, BuildListener listener)Create an aggregator that will calculate the environment once if onlyRunOnParent is true.Descriptor<BuildWrapper>getDescriptor()StringgetScript()We'll use this from the "config.jelly".StringgetScriptType()We will use this from the "config.jelly".booleanisHideEnvironmentVariablesValues()booleanisRunOnlyOnParent()BuildWrapper.EnvironmentsetUp(AbstractBuild build, Launcher launcher, BuildListener listener)-
Methods inherited from class hudson.tasks.BuildWrapper
all, decorateLauncher, decorateLogger, getProjectAction, getProjectActions, makeBuildVariables, makeSensitiveBuildVariables, preCheckout, setUp
-
-
-
-
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
MatrixBuildparent, or on the individualMatrixRuns.
-
isHideEnvironmentVariablesValues
public boolean isHideEnvironmentVariablesValues()
-
setUp
public BuildWrapper.Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
- Overrides:
setUpin classBuildWrapper- Throws:
IOExceptionInterruptedException
-
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 typePersistedEnvironment) 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:
createAggregatorin interfacehudson.matrix.MatrixAggregatable
-
getDescriptor
public Descriptor<BuildWrapper> getDescriptor()
- Specified by:
getDescriptorin interfaceDescribable<BuildWrapper>- Overrides:
getDescriptorin classAbstractDescribableImpl<BuildWrapper>
-
-