diff --git a/demos/docker/README.md b/demos/docker/README.md index 608e5d72..7a177256 100644 --- a/demos/docker/README.md +++ b/demos/docker/README.md @@ -19,9 +19,10 @@ jenkins: dockerTemplateBase: # TODO: pin sha256 or versions when using in production image: "jenkins/agent" - volumes: - - hello:/hello - - world:/world + mounts: + - "type=tmpfs,destination=/run" + - "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" + - "type=volume,src=hello,dst=/world" environmentsString: | hello=world foo=bar diff --git a/demos/jenkins/jenkins.yaml b/demos/jenkins/jenkins.yaml index 7fc2ed5d..41843dd8 100644 --- a/demos/jenkins/jenkins.yaml +++ b/demos/jenkins/jenkins.yaml @@ -24,9 +24,10 @@ jenkins: - labelString: "docker-agent" dockerTemplateBase: image: "jenkins/slave" - volumes: - - hello:/hello - - world:/world + mounts: + - "type=tmpfs,destination=/run" + - "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" + - "type=volume,src=hello,dst=/world" environmentsString: | hello=world foo=bar diff --git a/integrations/pom.xml b/integrations/pom.xml index f4b1d07b..1d182e4b 100644 --- a/integrations/pom.xml +++ b/integrations/pom.xml @@ -126,7 +126,7 @@ io.jenkins.docker docker-plugin - 1.2.2 + 1.2.8 test diff --git a/integrations/src/test/java/io/jenkins/plugins/casc/DockerCloudTest.java b/integrations/src/test/java/io/jenkins/plugins/casc/DockerCloudTest.java index 8b344ec5..961bbb57 100644 --- a/integrations/src/test/java/io/jenkins/plugins/casc/DockerCloudTest.java +++ b/integrations/src/test/java/io/jenkins/plugins/casc/DockerCloudTest.java @@ -34,7 +34,8 @@ public class DockerCloudTest { final DockerTemplate template = docker.getTemplate("jenkins/agent"); checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", - new String[] { "hello:/hello", "world:/world"}, "hello=world\nfoo=bar"); + new String[] { "type=tmpfs,destination=/run", "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock", "type=volume,src=hello,dst=/world" }, + "hello=world\nfoo=bar"); assertTrue(template.getRetentionStrategy() instanceof DockerOnceRetentionStrategy); assertEquals(1, ((DockerOnceRetentionStrategy) template.getRetentionStrategy()).getIdleMinutes()); } @@ -50,7 +51,8 @@ public class DockerCloudTest { DockerTemplate template = docker.getTemplate(Label.get("docker-agent")); checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", - new String[] { "hello:/hello", "world:/world"}, "hello=world\nfoo=bar"); + new String[] { "type=tmpfs,destination=/run", "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock", "type=volume,src=hello,dst=/world" }, + "hello=world\nfoo=bar"); ConfigurationAsCode.get().configure(getClass().getResource("DockerCloudTest2.yml").toExternalForm()); @@ -62,21 +64,23 @@ public class DockerCloudTest { template = docker.getTemplate(Label.get("docker-agent")); checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", - new String[] { "hello:/hello", "world:/world"}, "hello=world\nfoo=bar"); + new String[] { "type=volume,source=hello,destination=/hello", "type=volume,source=world,destination=/world"}, + "hello=world\nfoo=bar"); template = docker.getTemplate(Label.get("generic")); checkTemplate(template, "generic", "jenkins", "/home/jenkins/agent2", "5", - new String[] { "hello:/hello", "world:/world"}, "hello=world\nfoo=bar"); + new String[] { "type=volume,source=hello,destination=/hello", "type=volume,source=world,destination=/world"}, + "hello=world\nfoo=bar"); } private void checkTemplate(DockerTemplate template, String labelString, String user, String remoteFs, - String instanceCapStr, String[] volumes, String environmentsString) { + String instanceCapStr, String[] mounts, String environmentsString) { assertNotNull(template); assertEquals(labelString, template.getLabelString()); assertEquals(user, ((DockerComputerAttachConnector) template.getConnector()).getUser()); assertEquals(remoteFs, template.getRemoteFs()); assertEquals(instanceCapStr, template.getInstanceCapStr()); - assertArrayEquals(volumes, template.getVolumes()); + assertArrayEquals(mounts, template.getMounts()); assertEquals(environmentsString, template.getEnvironmentsString()); } } diff --git a/integrations/src/test/resources/io/jenkins/plugins/casc/DockerCloudTest2.yml b/integrations/src/test/resources/io/jenkins/plugins/casc/DockerCloudTest2.yml index 2f73c59c..d8afaaa8 100644 --- a/integrations/src/test/resources/io/jenkins/plugins/casc/DockerCloudTest2.yml +++ b/integrations/src/test/resources/io/jenkins/plugins/casc/DockerCloudTest2.yml @@ -9,9 +9,9 @@ jenkins: - labelString: "docker-agent" dockerTemplateBase: image: "jenkins/slave" - volumes: - - hello:/hello - - world:/world + mounts: + - type=volume,source=hello,destination=/hello + - type=volume,source=world,destination=/world environmentsString: | hello=world foo=bar @@ -24,9 +24,9 @@ jenkins: - labelString: "generic" dockerTemplateBase: image: "jenkins/slave" - volumes: - - hello:/hello - - world:/world + mounts: + - type=volume,source=hello,destination=/hello + - type=volume,source=world,destination=/world environmentsString: | hello=world foo=bar