@Extension(ordinal=-100.0) @Symbol(value="core") public class CoreEnvironmentContributor extends EnvironmentContributor
EnvironmentContributor
that adds the basic set of environment variables that
we've been exposing historically.EnvironmentContributor.EnvVarsHtml
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
CoreEnvironmentContributor() |
Modifier and Type | Method and Description |
---|---|
void |
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.
|
all
public void buildEnvironmentFor(Run r, EnvVars env, TaskListener listener) throws IOException, InterruptedException
EnvironmentContributor
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.
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.
buildEnvironmentFor
in class EnvironmentContributor
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.IOException
InterruptedException
public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException
EnvironmentContributor
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.
buildEnvironmentFor
in class EnvironmentContributor
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.IOException
InterruptedException
Copyright © 2004–2021. All rights reserved.