|
71 | 71 | import io.fabric8.kubernetes.api.model.VolumeMount; |
72 | 72 | import io.fabric8.kubernetes.api.model.VolumeMountBuilder; |
73 | 73 | import io.fabric8.kubernetes.client.utils.Serialization; |
74 | | - |
| 74 | +import io.jenkins.lib.versionnumber.JavaSpecificationVersion; |
75 | 75 | import jenkins.model.Jenkins; |
76 | 76 |
|
77 | 77 | import javax.annotation.CheckForNull; |
@@ -103,7 +103,7 @@ public class PodTemplateBuilder { |
103 | 103 | .getProperty(PodTemplateStepExecution.class.getName() + ".dockerRegistryPrefix"); |
104 | 104 | @Restricted(NoExternalUse.class) |
105 | 105 | static final String DEFAULT_JNLP_IMAGE = System |
106 | | - .getProperty(PodTemplateStepExecution.class.getName() + ".defaultImage", "jenkins/inbound-agent:4.3-4"); |
| 106 | + .getProperty(PodTemplateStepExecution.class.getName() + ".defaultImage", getDefaultImageName()); |
107 | 107 |
|
108 | 108 | static final String DEFAULT_JNLP_CONTAINER_MEMORY_REQUEST = System |
109 | 109 | .getProperty(PodTemplateStepExecution.class.getName() + ".defaultContainer.defaultMemoryRequest", "256Mi"); |
@@ -137,6 +137,15 @@ public PodTemplateBuilder(PodTemplate template, KubernetesSlave agent) { |
137 | 137 | this.cloud = agent.getKubernetesCloud(); |
138 | 138 | } |
139 | 139 |
|
| 140 | + private static String getDefaultImageName() { |
| 141 | + // TODO: Reverse logic after inbound-agent:4.9-1 |
| 142 | + String name = "jenkins/inbound-agent:4.3-4"; |
| 143 | + if (JavaSpecificationVersion.forCurrentJVM().isNewerThanOrEqualTo(JavaSpecificationVersion.JAVA_11)) { |
| 144 | + name = name + "-jdk11"; |
| 145 | + } |
| 146 | + return name; |
| 147 | + } |
| 148 | + |
140 | 149 | public PodTemplateBuilder withSlave(@Nonnull KubernetesSlave slave) { |
141 | 150 | this.agent = slave; |
142 | 151 | this.cloud = slave.getKubernetesCloud(); |
|
0 commit comments