public abstract class EnvironmentExpander extends Object implements Serializable
StepContext.get(java.lang.Class<T>)
instead of raw EnvVars
.
Pass into BodyInvoker.withContext(java.lang.Object)
.Constructor and Description |
---|
EnvironmentExpander() |
Modifier and Type | Method and Description |
---|---|
abstract void |
expand(hudson.EnvVars env)
May add environment variables to a context.
|
static hudson.EnvVars |
getEffectiveEnvironment(hudson.EnvVars customEnvironment,
hudson.EnvVars contextualEnvironment,
EnvironmentExpander expander)
Computes an effective environment in a given context.
|
static EnvironmentExpander |
merge(EnvironmentExpander original,
EnvironmentExpander subsequent)
Merge together two expanders.
|
public abstract void expand(@Nonnull hudson.EnvVars env) throws IOException, InterruptedException
env
- an original set of environment variablesIOException
InterruptedException
public static EnvironmentExpander merge(@CheckForNull EnvironmentExpander original, @Nonnull EnvironmentExpander subsequent)
original
- an original one, such as one already found in a contextsubsequent
- what you are addingsubsequent
in case original
is null)@Nonnull public static hudson.EnvVars getEffectiveEnvironment(@Nonnull hudson.EnvVars customEnvironment, @CheckForNull hudson.EnvVars contextualEnvironment, @CheckForNull EnvironmentExpander expander) throws IOException, InterruptedException
DefaultStepContext
and EnvActionImpl
.
The precedence order is:
expander
(if any)
customEnvironment
contextualEnvironment
(if any)
customEnvironment
- Run.getEnvironment(TaskListener)
, or EnvironmentAction#getEnvironment
contextualEnvironment
- a possible override as per BodyInvoker.withContext(java.lang.Object)
(such as from Computer.getEnvironment()
called from PlaceholderExecutable
)expander
- a possible expanderIOException
InterruptedException
Copyright © 2016–2017. All rights reserved.