doc: update Docker Cloud examples (#1960)
This commit is contained in:
parent
09b044ac93
commit
45cb4a08d9
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
<dependency>
|
||||
<groupId>io.jenkins.docker</groupId>
|
||||
<artifactId>docker-plugin</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.2.8</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue