From a226005deca90b248b988b71adb6efdeeaa126f6 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 31 Oct 2019 10:32:29 +0100 Subject: [PATCH] Use explicitly a more recent jnlp-slave to avoid problems with cached docker images --- .../jenkins/plugins/kubernetes/PodTemplateBuilder.java | 6 ++++-- .../jenkins/plugins/kubernetes/PodTemplateBuilderTest.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilder.java b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilder.java index 56930b250e..cdfea5c928 100644 --- a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilder.java +++ b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilder.java @@ -41,6 +41,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +import com.google.common.annotations.VisibleForTesting; import io.fabric8.kubernetes.api.model.PodSpecFluent; import org.apache.commons.lang.StringUtils; import org.csanchez.jenkins.plugins.kubernetes.model.TemplateEnvVar; @@ -93,8 +94,9 @@ public class PodTemplateBuilder { private static final String WORKSPACE_VOLUME_NAME = "workspace-volume"; - private static final String DEFAULT_JNLP_IMAGE = System - .getProperty(PodTemplateStepExecution.class.getName() + ".defaultImage", "jenkins/jnlp-slave:alpine"); + @VisibleForTesting + static final String DEFAULT_JNLP_IMAGE = System + .getProperty(PodTemplateStepExecution.class.getName() + ".defaultImage", "jenkins/jnlp-slave:3.35-5-alpine"); private static final String JNLPMAC_REF = "\\$\\{computer.jnlpmac\\}"; private static final String NAME_REF = "\\$\\{computer.name\\}"; diff --git a/src/test/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilderTest.java b/src/test/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilderTest.java index 33aded7482..9412ff6b89 100644 --- a/src/test/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilderTest.java +++ b/src/test/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateBuilderTest.java @@ -267,7 +267,7 @@ private void validatePod(Pod pod, boolean fromYaml, boolean directConnection) { assertEquals(2, containers.size()); assertEquals("busybox", containers.get("busybox").getImage()); - assertEquals("jenkins/jnlp-slave:alpine", containers.get("jnlp").getImage()); + assertEquals(DEFAULT_JNLP_IMAGE, containers.get("jnlp").getImage()); // check volumes and volume mounts Map volumes = pod.getSpec().getVolumes().stream()