hudson.slaves
Class EnvironmentVariablesNodeProperty

java.lang.Object
  extended by hudson.slaves.NodeProperty<Node>
      extended by 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
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
EnvironmentVariablesNodeProperty(EnvironmentVariablesNodeProperty.Entry... env)
           
EnvironmentVariablesNodeProperty(List<EnvironmentVariablesNodeProperty.Entry> env)
           
 
Method Summary
 void buildEnvVars(EnvVars env, TaskListener listener)
          Creates environment variable override for launching child processes in this node.
 EnvVars getEnvVars()
           
 Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener)
          Runs before the SCM.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentVariablesNodeProperty

@DataBoundConstructor
public EnvironmentVariablesNodeProperty(List<EnvironmentVariablesNodeProperty.Entry> env)

EnvironmentVariablesNodeProperty

public EnvironmentVariablesNodeProperty(EnvironmentVariablesNodeProperty.Entry... env)
Method Detail

getEnvVars

public EnvVars getEnvVars()

setUp

public Environment setUp(AbstractBuild build,
                         Launcher launcher,
                         BuildListener listener)
                  throws IOException,
                         InterruptedException
Description copied from class: NodeProperty
Runs before the SCM.checkout(AbstractBuild, Launcher, FilePath, BuildListener, File) runs, and performs a set up. Can contribute additional properties to the environment.

Overrides:
setUp in class NodeProperty<Node>
Parameters:
build - The build in progress for which an Environment 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 then Environment.buildEnvVars(Map) will be added on top. This allows implementations to put node-scoped environment variables here, then build scoped variables to NodeProperty.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 from Environment.buildEnvVars(Map).

Overrides:
buildEnvVars in class NodeProperty<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 slave process itself.
listener - Can be used to send messages.
Throws:
IOException
InterruptedException


Copyright © 2004-2013. All Rights Reserved.