Class CoreEnvironmentContributor
- All Implemented Interfaces:
ExtensionPoint
EnvironmentContributor
that adds the basic set of environment variables that
we've been exposing historically.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.EnvironmentContributor
EnvironmentContributor.EnvVarsHtml
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
buildEnvironmentFor
(Job j, EnvVars env, TaskListener listener) Contributes environment variables used for a job.void
buildEnvironmentFor
(Run r, EnvVars env, TaskListener listener) Contributes environment variables used for a build.Methods inherited from class hudson.model.EnvironmentContributor
all
-
Constructor Details
-
CoreEnvironmentContributor
public CoreEnvironmentContributor()
-
-
Method Details
-
buildEnvironmentFor
public void buildEnvironmentFor(Run r, EnvVars env, TaskListener listener) throws IOException, InterruptedException Description copied from class:EnvironmentContributor
Contributes environment variables used for a build.This method can be called repeatedly for the same
Run
, thus the computation of this method needs to be efficient. If you have a time-consuming computation, one strategy is to take the hit once and then add the result asInvisibleAction
toRun
, then reuse those values later on.This method gets invoked concurrently for multiple
Run
s that are being built at the same time, so it must be concurrent-safe.When building environment variables for a build, Jenkins will also invoke
EnvironmentContributor.buildEnvironmentFor(Job, EnvVars, TaskListener)
. This method only needs to add variables that are scoped to builds.- Overrides:
buildEnvironmentFor
in classEnvironmentContributor
- Parameters:
r
- Build that's being performed.env
- Partially built environment variable map. Implementation of this method is expected to add additional variables here.listener
- Connected to the build console. Can be used to report errors.- Throws:
IOException
InterruptedException
-
buildEnvironmentFor
public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException Description copied from class:EnvironmentContributor
Contributes environment variables used for a job.This method can be called repeatedly for the same
Job
, thus the computation of this method needs to be efficient.This method gets invoked concurrently for multiple
Job
s, so it must be concurrent-safe.- Overrides:
buildEnvironmentFor
in classEnvironmentContributor
- Parameters:
j
- Job for which some activities are launched.env
- Partially built environment variable map. Implementation of this method is expected to add additional variables here.listener
- Connected to the build console. Can be used to report errors.- Throws:
IOException
InterruptedException
-