Skip to content
Permalink
Browse files

[FIXED JENKINS-25914] Allow the env pseudo-property to be accessed ev…

…en when using sandboxed scripts.

Originally-Committed-As: 0ee3e93e78013326cb49f800055c21f6044e6ce1
  • Loading branch information...
jglick committed Dec 4, 2014
1 parent a54a191 commit c327ece69190efa61d21cd4f7c7132c3b1029699
@@ -625,7 +625,7 @@ public static void finish(final boolean terminate) {
+ " semaphore 'env'\n"
+ " env.BUILD_TAG=\"${env.BUILD_TAG}2\"\n"
+ " sh 'echo tag3=$BUILD_TAG stuff=$STUFF'\n"
+ "}"));
+ "}", true));
startBuilding();
SemaphoreStep.waitForStart("env/1", b);
assertTrue(b.isBuilding());
@@ -8,6 +8,8 @@

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;

/**
* {@link Whitelist} implementation for CPS flow execution.
@@ -34,6 +36,16 @@ public boolean permitsMethod(Method method, Object receiver, Object[] args) {
// These are just aliases for EchoStep.
return true;
}
if (name.equals("getProperty") && Arrays.asList(args).equals(Collections.singletonList("env"))) {
return true;
}
}
// TODO JENKINS-24982: it would be nice if AnnotatedWhitelist accepted @Whitelisted on an override
if (receiver instanceof EnvActionImpl) {
String name = method.getName();
if (name.equals("getProperty") || name.equals("setProperty")) {
return true;
}
}
return false;
}

0 comments on commit c327ece

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.