Package jenkins.model

Class CoreEnvironmentContributor

java.lang.Object
hudson.model.EnvironmentContributor
jenkins.model.CoreEnvironmentContributor
All Implemented Interfaces:
ExtensionPoint

@Extension(ordinal=-100.0) @Symbol("core") public class CoreEnvironmentContributor extends EnvironmentContributor
EnvironmentContributor that adds the basic set of environment variables that we've been exposing historically.
Author:
Kohsuke Kawaguchi
  • 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 as InvisibleAction to Run, then reuse those values later on.

      This method gets invoked concurrently for multiple Runs 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 class EnvironmentContributor
      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 Jobs, so it must be concurrent-safe.

      Overrides:
      buildEnvironmentFor in class EnvironmentContributor
      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