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 class
EnvironmentScript.EnvironmentScriptDescriptor
Descriptor 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.MatrixAggregator
createAggregator(hudson.matrix.MatrixBuild build, Launcher launcher, BuildListener listener)
Create an aggregator that will calculate the environment once if onlyRunOnParent is true.Descriptor<BuildWrapper>
getDescriptor()
String
getScript()
We'll use this from the "config.jelly".String
getScriptType()
We will use this from the "config.jelly".boolean
isHideEnvironmentVariablesValues()
boolean
isRunOnlyOnParent()
BuildWrapper.Environment
setUp(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
MatrixBuild
parent, or on the individualMatrixRun
s.
-
isHideEnvironmentVariablesValues
public boolean isHideEnvironmentVariablesValues()
-
setUp
public BuildWrapper.Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
- Overrides:
setUp
in classBuildWrapper
- Throws:
IOException
InterruptedException
-
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:
createAggregator
in interfacehudson.matrix.MatrixAggregatable
-
getDescriptor
public Descriptor<BuildWrapper> getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<BuildWrapper>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<BuildWrapper>
-
-