diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java index 465705de51..d62f427289 100644 --- a/core/src/main/java/hudson/model/AbstractBuild.java +++ b/core/src/main/java/hudson/model/AbstractBuild.java @@ -852,6 +852,19 @@ public abstract class AbstractBuild

,R extends Abs return new EnvironmentList(buildEnvironments==null ? Collections.emptyList() : ImmutableList.copyOf(buildEnvironments)); } + /** + * Allows you to contribute an environment without going through {@link BuildWrapper}. + *

+ * For concurrency, this method is only designed to be called from the executor that's doing a build, + * during the build. + * + * @since 1.444 + */ + public void addEnvironment(Environment env) { + if (env!=null) + buildEnvironments.add(env); + } + public Calendar due() { return getTimestamp(); }