Class EnvironmentVariablesNodeProperty
- java.lang.Object
-
- hudson.slaves.NodeProperty<Node>
-
- hudson.slaves.EnvironmentVariablesNodeProperty
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<NodeProperty<?>>
,ReconfigurableDescribable<NodeProperty<?>>
public class EnvironmentVariablesNodeProperty extends NodeProperty<Node>
NodeProperty
that sets additional environment variables.- Since:
- 1.286
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EnvironmentVariablesNodeProperty.DescriptorImpl
static class
EnvironmentVariablesNodeProperty.Entry
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.slaves.NodeProperty
node
-
-
Constructor Summary
Constructors Constructor Description EnvironmentVariablesNodeProperty(EnvironmentVariablesNodeProperty.Entry... env)
EnvironmentVariablesNodeProperty(List<EnvironmentVariablesNodeProperty.Entry> env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildEnvVars(EnvVars env, TaskListener listener)
Creates environment variable override for launching child processes in this node.List<EnvironmentVariablesNodeProperty.Entry>
getEnv()
EnvVars
getEnvVars()
Environment
setUp(AbstractBuild build, Launcher launcher, BuildListener listener)
Runs before theSCM.checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)
runs, and performs a set up.-
Methods inherited from class hudson.slaves.NodeProperty
all, canTake, canTake, for_, getDescriptor, reconfigure, setNode
-
-
-
-
Constructor Detail
-
EnvironmentVariablesNodeProperty
@DataBoundConstructor public EnvironmentVariablesNodeProperty(List<EnvironmentVariablesNodeProperty.Entry> env)
-
EnvironmentVariablesNodeProperty
public EnvironmentVariablesNodeProperty(EnvironmentVariablesNodeProperty.Entry... env)
-
-
Method Detail
-
getEnvVars
public EnvVars getEnvVars()
-
getEnv
public List<EnvironmentVariablesNodeProperty.Entry> getEnv()
- Returns:
- environment variables using same data type as constructor parameter.
- Since:
- 2.136
-
setUp
public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
Description copied from class:NodeProperty
Runs before theSCM.checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)
runs, and performs a set up. Can contribute additional properties to the environment.- Overrides:
setUp
in classNodeProperty<Node>
- Parameters:
build
- The build in progress for which anEnvironment
object is created. Never null.launcher
- This launcher can be used to launch processes for this build. If the build runs remotely, launcher will also run a job on that remote machine. Never null.listener
- Can be used to send any message.- Returns:
- non-null if the build can continue, null if there was an error and the build needs to be aborted.
- Throws:
IOException
- terminates the build abnormally. Hudson will handle the exception and reports a nice error message.InterruptedException
-
buildEnvVars
public void buildEnvVars(EnvVars env, TaskListener listener) throws IOException, InterruptedException
Description copied from class:NodeProperty
Creates environment variable override for launching child processes in this node.Whereas
NodeProperty.setUp(AbstractBuild, Launcher, BuildListener)
is used specifically for executing builds, this method is used for other process launch activities that happens outside the context of a build, such as polling, one time action (tagging, deployment, etc.)Starting 1.489, this method and
NodeProperty.setUp(AbstractBuild, Launcher, BuildListener)
are layered properly. That is, for launching processes for a build, this method is called first and thenEnvironment.buildEnvVars(Map)
will be added on top. This allows implementations to put node-scoped environment variables here, then build scoped variables toNodeProperty.setUp(AbstractBuild, Launcher, BuildListener)
.Unfortunately, Jenkins core earlier than 1.488 only calls
NodeProperty.setUp(AbstractBuild, Launcher, BuildListener)
, so if the backward compatibility with these earlier versions is important, implementations should invoke this method fromEnvironment.buildEnvVars(Map)
.- Overrides:
buildEnvVars
in classNodeProperty<Node>
- Parameters:
env
- Manipulate this variable (normally by adding more entries.) Note that this is an override, so it doesn't contain environment variables that are currently set for the agent process itself.listener
- Can be used to send messages.- Throws:
IOException
InterruptedException
-
-