|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.EnvironmentContributor
public abstract class EnvironmentContributor
Contributes environment variables to builds.
This extension point can be used to externally add environment variables. Aside from adding environment variables
of the fixed name, a typical strategy is to look for specific JobProperty
s and other similar configurations
of Job
s to compute values.
When Jenkins displays the help page listing all the environment variables available for a build, it does
so by combining all the buildEnv
views from this extension point. This view should use the <t:buildEnvVar> tag
to render a variable.
In this view, it
points to EnvironmentContributor
and job
points to Job
for which
the help is being rendered.
Jenkins provides other extension points (such as SCM
) to contribute environment variables to builds,
and for those plugins, Jenkins also looks for /buildEnv.groovy
and aggregates them.
BuildVariableContributor
Nested Class Summary | |
---|---|
static class |
EnvironmentContributor.EnvVarsHtml
Serves the combined list of environment variables available from this plugin. |
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Constructor Summary | |
---|---|
EnvironmentContributor()
|
Method Summary | |
---|---|
static ExtensionList<EnvironmentContributor> |
all()
Returns all the registered EnvironmentContributor s. |
abstract void |
buildEnvironmentFor(Run r,
EnvVars envs,
TaskListener listener)
Contributes environment variables used for a build. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnvironmentContributor()
Method Detail |
---|
public abstract void buildEnvironmentFor(Run r, EnvVars envs, TaskListener listener) throws IOException, InterruptedException
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 as InvisibleAction
to Run
, 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.
r
- Build that's being performed. Never null.envs
- Partially built environment variable map. Implementation of this method is expected to
add additional variables here. Never null.listener
- Connected to the build console. Can be used to report errors. Never null.
IOException
InterruptedException
public static ExtensionList<EnvironmentContributor> all()
EnvironmentContributor
s.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |