Skip to content

Commit

Permalink
[JENKINS-40847] When upgrading from <0.9 set the container name to jnlp
Browse files Browse the repository at this point in the history
To avoid creating an extra container, the one that exists and the new jnlp auto generated
  • Loading branch information
carlossg committed Feb 12, 2017
1 parent ad4193e commit 15f996c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
CHANGELOG
=========

* **NOTE if you have defined a JNLP container in your Pod definition**, you need to remove it or rename it to `jnlp`, otherwise a new container called `jnlp` will be created.

* Pod Template "Annotations" Field [#105](https://github.com/jenkinsci/kubernetes-plugin/pull/105)
* The workspace volume is now configurable [#114](https://github.com/jenkinsci/kubernetes-plugin/pull/114)

* When upgrading from <0.9 set the container name to jnlp. To avoid creating an extra container, the one that exists and the new jnlp auto generated [#132](https://github.com/jenkinsci/kubernetes-plugin/pull/132)
* Remove node if pod startup fails [#122](https://github.com/jenkinsci/kubernetes-plugin/pull/122)
* Avoid NPE if cloud is deleted or renamed [#118](https://github.com/jenkinsci/kubernetes-plugin/pull/118)
* Fixing deletion of containers in pod templates, containers property is databound [#113](https://github.com/jenkinsci/kubernetes-plugin/pull/113)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class KubernetesCloud extends Cloud {
private static final String DEFAULT_ID = "jenkins/slave-default";
private static final String WORKSPACE_VOLUME_NAME = "workspace-volume";

private static final String JNLP_NAME = "jnlp";
public static final String JNLP_NAME = "jnlp";
private static final String DEFAULT_JNLP_ARGUMENTS = "${computer.jnlpmac} ${computer.name}";

private static final String DEFAULT_JNLP_IMAGE = System
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ protected Object readResolve() {
if (containers == null) {
// upgrading from 0.8
containers = new ArrayList<ContainerTemplate>();
ContainerTemplate containerTemplate = new ContainerTemplate(this.name, this.image);
ContainerTemplate containerTemplate = new ContainerTemplate(KubernetesCloud.JNLP_NAME, this.image);
containerTemplate.setCommand(command);
containerTemplate.setArgs(Strings.isNullOrEmpty(args) ? FALLBACK_ARGUMENTS : args);
containerTemplate.setPrivileged(privileged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void assertPodTemplates(List<PodTemplate> templates) {
assertEquals(1, podTemplate.getContainers().size());
ContainerTemplate containerTemplate = podTemplate.getContainers().get(0);
assertEquals("jenkinsci/jnlp-slave", containerTemplate.getImage());
assertEquals("java", containerTemplate.getName());
assertEquals("jnlp", containerTemplate.getName());
assertEquals(Arrays.asList(new ContainerEnvVar("a", "b"), new ContainerEnvVar("c", "d")),
containerTemplate.getEnvVars());
assertEquals(2, podTemplate.getVolumes().size());
Expand Down

0 comments on commit 15f996c

Please sign in to comment.