Package jenkins.model

Class CoreEnvironmentContributor

    • Constructor Detail

      • CoreEnvironmentContributor

        public CoreEnvironmentContributor()
    • Method Detail

      • 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