Skip to content
Permalink
Browse files

Merge pull request #6 from oleg-nenashev/JENKINS-29867-hide-envvars

[JENKINS-29867] - Expose owner runs in the action
  • Loading branch information...
oleg-nenashev committed Aug 10, 2015
2 parents caf1a25 + fa6e1a0 commit 9ffb2877e3e483b8ce165fad2821144c6e7b928a
Showing with 16 additions and 5 deletions.
  1. +16 −5 src/main/java/org/jenkinsci/lib/envinject/EnvInjectAction.java
@@ -4,6 +4,7 @@
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.AbstractProject; import hudson.model.AbstractProject;
import hudson.model.Action; import hudson.model.Action;
import hudson.model.Run;
import org.apache.commons.collections.map.UnmodifiableMap; import org.apache.commons.collections.map.UnmodifiableMap;
import org.jenkinsci.lib.envinject.service.EnvInjectSavable; import org.jenkinsci.lib.envinject.service.EnvInjectSavable;
import org.kohsuke.stapler.StaplerProxy; import org.kohsuke.stapler.StaplerProxy;
@@ -14,7 +15,9 @@
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.annotation.CheckForNull; import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;


//TODO: Convert to RunAction2
/** /**
* @author Gregory Boissinot * @author Gregory Boissinot
*/ */
@@ -23,8 +26,8 @@
public static final String URL_NAME = "injectedEnvVars"; public static final String URL_NAME = "injectedEnvVars";


protected transient @CheckForNull Map<String, String> envMap; protected transient @CheckForNull Map<String, String> envMap;

private AbstractBuild build; private @Nonnull AbstractBuild build;


/** /**
* Backward compatibility * Backward compatibility
@@ -33,7 +36,7 @@
private transient File rootDir; private transient File rootDir;
private transient @CheckForNull Set<String> sensibleVariables; private transient @CheckForNull Set<String> sensibleVariables;


public EnvInjectAction(AbstractBuild build, public EnvInjectAction(@Nonnull AbstractBuild build,
@CheckForNull Map<String, String> envMap) { @CheckForNull Map<String, String> envMap) {
this.build = build; this.build = build;
this.envMap = envMap; this.envMap = envMap;
@@ -111,7 +114,7 @@ public String transformEntry(String key, String value) {
} }




private Map<String, String> getEnvironment(AbstractBuild build) throws EnvInjectException { private Map<String, String> getEnvironment(@CheckForNull AbstractBuild build) throws EnvInjectException {


if (build == null) { if (build == null) {
return null; return null;
@@ -126,7 +129,15 @@ public String transformEntry(String key, String value) {
return dao.getEnvironment(build.getRootDir()); return dao.getEnvironment(build.getRootDir());
} }



/**
* Retrieves an owner {@link Run} of this action.
* @return {@link Run}, which contains the action
* @since TODO
*/
public Run<?,?> getOwner() {
return build;
}

@SuppressWarnings("unused") @SuppressWarnings("unused")
private Object readResolve() throws ObjectStreamException { private Object readResolve() throws ObjectStreamException {


0 comments on commit 9ffb287

Please sign in to comment.
You can’t perform that action at this time.