Skip to content

Commit

Permalink
Merge pull request #75 from jglick/GlobalVariable-JENKINS-32731
Browse files Browse the repository at this point in the history
[JENKINS-32731] [JENKINS-34650] Docker.groovy is already trusted
  • Loading branch information
jglick committed Oct 31, 2016
2 parents 1f5f9d0 + 0e95a7b commit 223612b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
15 changes: 3 additions & 12 deletions pom.xml
Expand Up @@ -4,7 +4,8 @@
<parent> <parent>
<groupId>org.jenkins-ci.plugins</groupId> <groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId> <artifactId>plugin</artifactId>
<version>2.11</version> <version>2.17</version>
<relativePath/>
</parent> </parent>
<artifactId>docker-workflow</artifactId> <artifactId>docker-workflow</artifactId>
<version>1.10-SNAPSHOT</version> <version>1.10-SNAPSHOT</version>
Expand Down Expand Up @@ -48,20 +49,10 @@
<artifactId>docker-commons</artifactId> <artifactId>docker-commons</artifactId>
<version>1.5</version> <version>1.5</version>
</dependency> </dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId> <groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId> <artifactId>workflow-cps</artifactId>
<version>2.7</version> <version>2.17</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId> <groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/jenkinsci/plugins/docker/workflow/DockerDSL.java
Expand Up @@ -25,9 +25,6 @@


import groovy.lang.Binding; import groovy.lang.Binding;
import hudson.Extension; import hudson.Extension;
import java.io.IOException;
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.ProxyWhitelist;
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist;
import org.jenkinsci.plugins.workflow.cps.CpsScript; import org.jenkinsci.plugins.workflow.cps.CpsScript;
import org.jenkinsci.plugins.workflow.cps.GlobalVariable; import org.jenkinsci.plugins.workflow.cps.GlobalVariable;


Expand All @@ -50,13 +47,4 @@
return docker; return docker;
} }


@Extension public static class MiscWhitelist extends ProxyWhitelist {
public MiscWhitelist() throws IOException {
super(new StaticWhitelist(
// TODO should docker-commons just get a script-security dependency and mark these things @Whitelisted?
"new org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint java.lang.String java.lang.String",
"method org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint imageName java.lang.String"));
}
}

} }
Expand Up @@ -23,8 +23,6 @@
*/ */
package org.jenkinsci.plugins.docker.workflow; package org.jenkinsci.plugins.docker.workflow;


import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;

import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.io.Serializable; import java.io.Serializable;


Expand All @@ -42,12 +40,9 @@ public class ImageNameTokens implements Serializable {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


@Whitelisted
public final String userAndRepo; public final String userAndRepo;
@Whitelisted
public final String tag; public final String tag;


@Whitelisted
public ImageNameTokens(@Nonnull String name) { public ImageNameTokens(@Nonnull String name) {
int tagIdx = name.lastIndexOf(':'); int tagIdx = name.lastIndexOf(':');
if (tagIdx != -1) { if (tagIdx != -1) {
Expand Down
Expand Up @@ -34,7 +34,7 @@ class Docker implements Serializable {
public <V> V withRegistry(String url, String credentialsId = null, Closure<V> body) { public <V> V withRegistry(String url, String credentialsId = null, Closure<V> body) {
node { node {
script.withEnv(["DOCKER_REGISTRY_URL=${url}"]) { script.withEnv(["DOCKER_REGISTRY_URL=${url}"]) {
script.withDockerRegistry(registry: [url: url, credentialsId: credentialsId]) { script.withDockerRegistry([url: url, credentialsId: credentialsId]) {
body() body()
} }
} }
Expand All @@ -43,7 +43,7 @@ class Docker implements Serializable {


public <V> V withServer(String uri, String credentialsId = null, Closure<V> body) { public <V> V withServer(String uri, String credentialsId = null, Closure<V> body) {
node { node {
script.withDockerServer(server: [uri: uri, credentialsId: credentialsId]) { script.withDockerServer([uri: uri, credentialsId: credentialsId]) {
body() body()
} }
} }
Expand Down

0 comments on commit 223612b

Please sign in to comment.