2018-08-21 15:45:59 +02:00
|
|
|
import com.sap.piper.k8s.ContainerMap
|
|
|
|
import com.sap.piper.JenkinsUtils
|
2018-08-31 10:22:43 +02:00
|
|
|
|
2017-12-06 13:03:06 +02:00
|
|
|
import org.junit.Before
|
2018-01-16 10:33:13 +02:00
|
|
|
import org.junit.Rule
|
2017-12-06 13:03:06 +02:00
|
|
|
import org.junit.Test
|
2018-01-16 10:33:13 +02:00
|
|
|
import org.junit.rules.RuleChain
|
|
|
|
|
2018-06-06 11:19:19 +02:00
|
|
|
import util.BasePiperTest
|
2018-01-16 10:33:13 +02:00
|
|
|
import util.JenkinsLoggingRule
|
2018-08-31 10:22:43 +02:00
|
|
|
import util.JenkinsReadYamlRule
|
2019-03-18 15:05:42 +02:00
|
|
|
import util.JenkinsShellCallRule
|
2018-02-28 14:12:03 +02:00
|
|
|
import util.JenkinsStepRule
|
2018-08-21 15:45:59 +02:00
|
|
|
import util.PluginMock
|
|
|
|
import util.Rules
|
2017-12-06 13:03:06 +02:00
|
|
|
|
2018-10-04 17:06:42 +02:00
|
|
|
import static org.hamcrest.Matchers.*
|
|
|
|
import static org.junit.Assert.assertThat
|
2017-12-06 13:03:06 +02:00
|
|
|
import static org.junit.Assert.assertTrue
|
2018-08-21 15:45:59 +02:00
|
|
|
import static org.junit.Assert.assertEquals
|
2017-12-15 17:41:10 +02:00
|
|
|
import static org.junit.Assert.assertFalse
|
2017-12-06 13:03:06 +02:00
|
|
|
|
2018-06-06 11:19:19 +02:00
|
|
|
class DockerExecuteTest extends BasePiperTest {
|
2018-03-02 11:54:50 +02:00
|
|
|
private DockerMock docker
|
2019-01-22 10:22:15 +02:00
|
|
|
private JenkinsLoggingRule loggingRule = new JenkinsLoggingRule(this)
|
2019-01-22 10:25:42 +02:00
|
|
|
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
|
2019-03-18 15:05:42 +02:00
|
|
|
private JenkinsShellCallRule shellRule = new JenkinsShellCallRule(this)
|
2018-01-16 10:33:13 +02:00
|
|
|
|
|
|
|
@Rule
|
2018-02-28 14:12:03 +02:00
|
|
|
public RuleChain ruleChain = Rules
|
|
|
|
.getCommonRules(this)
|
2018-08-31 10:22:43 +02:00
|
|
|
.around(new JenkinsReadYamlRule(this))
|
2019-01-22 10:22:15 +02:00
|
|
|
.around(loggingRule)
|
2019-01-22 10:25:42 +02:00
|
|
|
.around(stepRule)
|
2019-03-18 15:05:42 +02:00
|
|
|
.around(shellRule)
|
2018-03-29 14:13:11 +02:00
|
|
|
|
2018-03-02 11:55:27 +02:00
|
|
|
def bodyExecuted
|
2018-08-21 15:45:59 +02:00
|
|
|
def containerName
|
2017-12-06 13:03:06 +02:00
|
|
|
|
|
|
|
@Before
|
2018-01-16 10:33:13 +02:00
|
|
|
void init() {
|
2018-01-16 18:06:25 +02:00
|
|
|
bodyExecuted = false
|
2017-12-06 13:03:06 +02:00
|
|
|
docker = new DockerMock()
|
2018-08-21 15:45:59 +02:00
|
|
|
JenkinsUtils.metaClass.static.isPluginActive = {def s -> new PluginMock(s).isActive()}
|
2017-12-06 13:03:06 +02:00
|
|
|
binding.setVariable('docker', docker)
|
2019-03-18 15:05:42 +02:00
|
|
|
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, "docker .*", 0)
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2018-08-21 15:45:59 +02:00
|
|
|
void testExecuteInsideContainerOfExistingPod() throws Exception {
|
|
|
|
helper.registerAllowedMethod('container', [String.class, Closure.class], { String container, Closure body ->
|
|
|
|
containerName = container
|
|
|
|
body()
|
|
|
|
})
|
|
|
|
binding.setVariable('env', [POD_NAME: 'testpod', ON_K8S: 'true'])
|
|
|
|
ContainerMap.instance.setMap(['testpod': ['maven:3.5-jdk-8-alpine': 'mavenexec']])
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-08-21 15:45:59 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2019-01-22 10:22:15 +02:00
|
|
|
assertTrue(loggingRule.log.contains('Executing inside a Kubernetes Container'))
|
2018-08-21 15:45:59 +02:00
|
|
|
assertEquals('mavenexec', containerName)
|
|
|
|
assertTrue(bodyExecuted)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void testExecuteInsideNewlyCreatedPod() throws Exception {
|
|
|
|
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { Map config, Closure body -> body() })
|
|
|
|
binding.setVariable('env', [ON_K8S: 'true'])
|
|
|
|
ContainerMap.instance.setMap(['testpod': ['maven:3.5-jdk-8-alpine': 'mavenexec']])
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-08-21 15:45:59 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2019-01-22 10:22:15 +02:00
|
|
|
assertTrue(loggingRule.log.contains('Executing inside a Kubernetes Pod'))
|
2018-08-21 15:45:59 +02:00
|
|
|
assertTrue(bodyExecuted)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void testExecuteInsidePodWithEmptyContainerMap() throws Exception {
|
|
|
|
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { Map config, Closure body -> body() })
|
|
|
|
binding.setVariable('env', [POD_NAME: 'testpod', ON_K8S: 'true'])
|
|
|
|
ContainerMap.instance.setMap([:])
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-08-21 15:45:59 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2019-01-22 10:22:15 +02:00
|
|
|
assertTrue(loggingRule.log.contains('Executing inside a Kubernetes Pod'))
|
2018-08-21 15:45:59 +02:00
|
|
|
assertTrue(bodyExecuted)
|
|
|
|
}
|
2018-01-16 18:06:25 +02:00
|
|
|
|
2018-08-21 15:45:59 +02:00
|
|
|
@Test
|
|
|
|
void testExecuteInsidePodWithStageKeyEmptyValue() throws Exception {
|
|
|
|
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { Map config, Closure body -> body() })
|
|
|
|
binding.setVariable('env', [POD_NAME: 'testpod', ON_K8S: 'true'])
|
|
|
|
ContainerMap.instance.setMap(['testpod':[:]])
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-08-21 15:45:59 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
|
2018-01-16 18:06:25 +02:00
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2019-01-22 10:22:15 +02:00
|
|
|
assertTrue(loggingRule.log.contains('Executing inside a Kubernetes Pod'))
|
2018-08-21 15:45:59 +02:00
|
|
|
assertTrue(bodyExecuted)
|
|
|
|
}
|
2018-01-16 18:06:25 +02:00
|
|
|
|
2019-01-14 15:43:07 +02:00
|
|
|
@Test
|
|
|
|
void testExecuteInsidePodWithCustomCommandAndShell() throws Exception {
|
|
|
|
Map kubernetesConfig = [:]
|
|
|
|
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], {Map config, Closure body ->
|
|
|
|
kubernetesConfig = config
|
|
|
|
return body()
|
|
|
|
})
|
|
|
|
binding.setVariable('env', [ON_K8S: 'true'])
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(
|
2019-01-14 15:43:07 +02:00
|
|
|
script: nullScript,
|
|
|
|
containerCommand: '/busybox/tail -f /dev/null',
|
|
|
|
containerShell: '/busybox/sh',
|
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine'
|
|
|
|
){
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2019-01-22 10:22:15 +02:00
|
|
|
assertTrue(loggingRule.log.contains('Executing inside a Kubernetes Pod'))
|
2019-01-14 15:43:07 +02:00
|
|
|
assertThat(kubernetesConfig.containerCommand, is('/busybox/tail -f /dev/null'))
|
|
|
|
assertThat(kubernetesConfig.containerShell, is('/busybox/sh'))
|
|
|
|
assertTrue(bodyExecuted)
|
|
|
|
}
|
|
|
|
|
2018-08-21 15:45:59 +02:00
|
|
|
@Test
|
|
|
|
void testExecuteInsideDockerContainer() throws Exception {
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript, dockerImage: 'maven:3.5-jdk-8-alpine') {
|
2018-08-21 15:45:59 +02:00
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2017-12-06 13:03:06 +02:00
|
|
|
assertEquals('maven:3.5-jdk-8-alpine', docker.getImageName())
|
|
|
|
assertTrue(docker.isImagePulled())
|
2018-03-29 14:13:11 +02:00
|
|
|
assertEquals('--env http_proxy --env https_proxy --env no_proxy --env HTTP_PROXY --env HTTPS_PROXY --env NO_PROXY', docker.getParameters().trim())
|
2018-01-16 18:06:25 +02:00
|
|
|
assertTrue(bodyExecuted)
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
|
|
|
|
2019-02-06 09:48:33 +02:00
|
|
|
@Test
|
|
|
|
void testSkipDockerImagePull() throws Exception {
|
|
|
|
nullScript.commonPipelineEnvironment.configuration = [steps:[dockerExecute:[dockerPullImage: false]]]
|
|
|
|
stepRule.step.dockerExecute(
|
|
|
|
script: nullScript,
|
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine'
|
|
|
|
) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
|
|
|
assertThat(docker.imagePullCount, is(0))
|
|
|
|
assertThat(bodyExecuted, is(true))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void testSkipSidecarImagePull() throws Exception {
|
|
|
|
stepRule.step.dockerExecute(
|
|
|
|
script: nullScript,
|
|
|
|
dockerName: 'maven',
|
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
sidecarEnvVars: ['testEnv':'testVal'],
|
|
|
|
sidecarImage: 'selenium/standalone-chrome',
|
|
|
|
sidecarVolumeBind: ['/dev/shm':'/dev/shm'],
|
|
|
|
sidecarName: 'testAlias',
|
|
|
|
sidecarPorts: ['4444':'4444', '1111':'1111'],
|
|
|
|
sidecarPullImage: false
|
|
|
|
) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
|
|
|
assertThat(docker.imagePullCount, is(1))
|
|
|
|
assertThat(bodyExecuted, is(true))
|
|
|
|
}
|
|
|
|
|
2018-08-21 15:45:59 +02:00
|
|
|
@Test
|
|
|
|
void testExecuteInsideDockerContainerWithParameters() throws Exception {
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-01-16 18:06:25 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
2019-01-18 14:40:15 +02:00
|
|
|
dockerOptions: '-description=lorem ipsum',
|
2018-01-16 18:06:25 +02:00
|
|
|
dockerVolumeBind: ['my_vol': '/my_vol'],
|
|
|
|
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2018-03-29 14:13:11 +02:00
|
|
|
assertTrue(docker.getParameters().contains('--env https_proxy '))
|
|
|
|
assertTrue(docker.getParameters().contains('--env http_proxy=http://proxy:8000'))
|
2019-01-18 14:40:15 +02:00
|
|
|
assertTrue(docker.getParameters().contains('description=lorem\\ ipsum'))
|
2018-03-29 14:13:11 +02:00
|
|
|
assertTrue(docker.getParameters().contains('--volume my_vol:/my_vol'))
|
2018-01-16 18:06:25 +02:00
|
|
|
assertTrue(bodyExecuted)
|
2017-12-06 13:03:06 +02:00
|
|
|
}
|
|
|
|
|
2018-03-29 14:13:11 +02:00
|
|
|
@Test
|
2018-08-21 15:45:59 +02:00
|
|
|
void testExecuteInsideDockerContainerWithDockerOptionsList() throws Exception {
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-03-29 14:13:11 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
2019-01-18 14:40:15 +02:00
|
|
|
dockerOptions: ['-it', '--network=my-network', 'description=lorem ipsum'],
|
2018-03-29 14:13:11 +02:00
|
|
|
dockerEnvVars: ['http_proxy': 'http://proxy:8000']) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
|
|
|
assertTrue(docker.getParameters().contains('--env http_proxy=http://proxy:8000'))
|
|
|
|
assertTrue(docker.getParameters().contains('-it'))
|
|
|
|
assertTrue(docker.getParameters().contains('--network=my-network'))
|
2019-01-18 14:40:15 +02:00
|
|
|
assertTrue(docker.getParameters().contains('description=lorem\\ ipsum'))
|
2018-03-29 14:13:11 +02:00
|
|
|
}
|
|
|
|
|
2018-01-16 16:42:11 +02:00
|
|
|
@Test
|
|
|
|
void testDockerNotInstalledResultsInLocalExecution() throws Exception {
|
2019-03-18 15:05:42 +02:00
|
|
|
shellRule.setReturnValue(JenkinsShellCallRule.Type.REGEX, "docker .*", 1)
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(script: nullScript,
|
2018-08-21 15:45:59 +02:00
|
|
|
dockerOptions: '-it') {
|
2018-01-16 18:06:25 +02:00
|
|
|
bodyExecuted = true
|
|
|
|
}
|
2019-01-22 10:22:15 +02:00
|
|
|
assertTrue(loggingRule.log.contains('Cannot connect to docker daemon'))
|
|
|
|
assertTrue(loggingRule.log.contains('Running on local environment'))
|
2018-01-16 18:06:25 +02:00
|
|
|
assertTrue(bodyExecuted)
|
2017-12-15 17:41:10 +02:00
|
|
|
assertFalse(docker.isImagePulled())
|
|
|
|
}
|
2017-12-06 13:03:06 +02:00
|
|
|
|
2018-10-04 17:06:42 +02:00
|
|
|
@Test
|
|
|
|
void testSidecarDefault(){
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(
|
2018-10-04 17:06:42 +02:00
|
|
|
script: nullScript,
|
2018-10-24 10:13:28 +02:00
|
|
|
dockerName: 'maven',
|
2018-10-04 17:06:42 +02:00
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
sidecarEnvVars: ['testEnv':'testVal'],
|
|
|
|
sidecarImage: 'selenium/standalone-chrome',
|
|
|
|
sidecarVolumeBind: ['/dev/shm':'/dev/shm'],
|
|
|
|
sidecarName: 'testAlias',
|
|
|
|
sidecarPorts: ['4444':'4444', '1111':'1111']
|
|
|
|
) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
|
|
|
|
|
|
|
assertThat(bodyExecuted, is(true))
|
|
|
|
assertThat(docker.imagePullCount, is(2))
|
|
|
|
assertThat(docker.sidecarParameters, allOf(
|
|
|
|
containsString('--env testEnv=testVal'),
|
2018-10-24 10:13:28 +02:00
|
|
|
containsString('--volume /dev/shm:/dev/shm'),
|
|
|
|
containsString('--network sidecar-'),
|
|
|
|
containsString('--network-alias testAlias')
|
|
|
|
))
|
|
|
|
assertThat(docker.parameters, allOf(
|
|
|
|
containsString('--network sidecar-'),
|
|
|
|
containsString('--network-alias maven')
|
2018-10-04 17:06:42 +02:00
|
|
|
))
|
|
|
|
}
|
|
|
|
|
2019-03-18 15:05:42 +02:00
|
|
|
@Test
|
|
|
|
void testSidecarHealthCheck(){
|
|
|
|
stepRule.step.dockerExecute(
|
|
|
|
script: nullScript,
|
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
sidecarImage: 'selenium/standalone-chrome',
|
|
|
|
sidecarName: 'testAlias',
|
|
|
|
sidecarReadyCommand: "isReady.sh"
|
|
|
|
) {}
|
|
|
|
assertThat(shellRule.shell, hasItem("docker exec uniqueId isReady.sh"))
|
|
|
|
}
|
|
|
|
|
2018-10-04 17:06:42 +02:00
|
|
|
@Test
|
|
|
|
void testSidecarKubernetes(){
|
|
|
|
boolean dockerExecuteOnKubernetesCalled = false
|
|
|
|
binding.setVariable('env', [ON_K8S: 'true'])
|
|
|
|
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { params, body ->
|
|
|
|
dockerExecuteOnKubernetesCalled = true
|
|
|
|
assertThat(params.containerCommands['selenium/standalone-chrome'], is(''))
|
|
|
|
assertThat(params.containerEnvVars, allOf(hasEntry('selenium/standalone-chrome', ['testEnv': 'testVal']),hasEntry('maven:3.5-jdk-8-alpine', null)))
|
|
|
|
assertThat(params.containerMap, allOf(hasEntry('maven:3.5-jdk-8-alpine', 'maven'), hasEntry('selenium/standalone-chrome', 'selenium')))
|
|
|
|
assertThat(params.containerName, is('maven'))
|
|
|
|
assertThat(params.containerPortMappings['selenium/standalone-chrome'], hasItem(allOf(hasEntry('containerPort', 4444), hasEntry('hostPort', 4444))))
|
|
|
|
assertThat(params.containerWorkspaces['maven:3.5-jdk-8-alpine'], is('/home/piper'))
|
|
|
|
assertThat(params.containerWorkspaces['selenium/standalone-chrome'], is(''))
|
|
|
|
body()
|
|
|
|
})
|
2019-01-22 10:25:42 +02:00
|
|
|
stepRule.step.dockerExecute(
|
2018-10-04 17:06:42 +02:00
|
|
|
script: nullScript,
|
|
|
|
containerPortMappings: [
|
|
|
|
'selenium/standalone-chrome': [[name: 'selPort', containerPort: 4444, hostPort: 4444]]
|
|
|
|
],
|
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
dockerName: 'maven',
|
|
|
|
dockerWorkspace: '/home/piper',
|
|
|
|
sidecarEnvVars: ['testEnv':'testVal'],
|
|
|
|
sidecarImage: 'selenium/standalone-chrome',
|
|
|
|
sidecarName: 'selenium',
|
2018-10-24 10:13:28 +02:00
|
|
|
sidecarVolumeBind: ['/dev/shm':'/dev/shm']
|
2018-10-04 17:06:42 +02:00
|
|
|
) {
|
|
|
|
bodyExecuted = true
|
|
|
|
}
|
|
|
|
assertThat(bodyExecuted, is(true))
|
|
|
|
assertThat(dockerExecuteOnKubernetesCalled, is(true))
|
|
|
|
}
|
|
|
|
|
2019-03-18 15:05:42 +02:00
|
|
|
@Test
|
|
|
|
void testSidecarKubernetesHealthCheck(){
|
|
|
|
binding.setVariable('env', [ON_K8S: 'true'])
|
|
|
|
|
|
|
|
helper.registerAllowedMethod('dockerExecuteOnKubernetes', [Map.class, Closure.class], { params, body ->
|
|
|
|
body()
|
|
|
|
})
|
|
|
|
|
|
|
|
def containerCalled = false
|
|
|
|
helper.registerAllowedMethod('container', [Map.class, Closure.class], { params, body ->
|
|
|
|
containerCalled = true
|
|
|
|
assertThat(params.name, is('testAlias'))
|
|
|
|
body()
|
|
|
|
})
|
|
|
|
|
|
|
|
stepRule.step.dockerExecute(
|
|
|
|
script: nullScript,
|
|
|
|
dockerImage: 'maven:3.5-jdk-8-alpine',
|
|
|
|
sidecarImage: 'selenium/standalone-chrome',
|
|
|
|
sidecarName: 'testAlias',
|
|
|
|
sidecarReadyCommand: "isReady.sh"
|
|
|
|
) {}
|
|
|
|
|
|
|
|
assertThat(containerCalled, is(true))
|
|
|
|
assertThat(shellRule.shell, hasItem("isReady.sh"))
|
|
|
|
}
|
|
|
|
|
2017-12-06 13:03:06 +02:00
|
|
|
private class DockerMock {
|
|
|
|
private String imageName
|
|
|
|
private boolean imagePulled = false
|
2018-10-04 17:06:42 +02:00
|
|
|
private int imagePullCount = 0
|
2017-12-06 13:03:06 +02:00
|
|
|
private String parameters
|
2018-10-04 17:06:42 +02:00
|
|
|
private String sidecarParameters
|
2017-12-06 13:03:06 +02:00
|
|
|
|
|
|
|
DockerMock image(String imageName) {
|
|
|
|
this.imageName = imageName
|
|
|
|
return this
|
|
|
|
}
|
|
|
|
|
|
|
|
void pull() {
|
2018-10-04 17:06:42 +02:00
|
|
|
imagePullCount++
|
2017-12-06 13:03:06 +02:00
|
|
|
imagePulled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
void inside(String parameters, body) {
|
|
|
|
this.parameters = parameters
|
|
|
|
body()
|
|
|
|
}
|
|
|
|
|
2018-10-04 17:06:42 +02:00
|
|
|
void withRun(String parameters, body) {
|
|
|
|
this.sidecarParameters = parameters
|
|
|
|
body([id: 'uniqueId'])
|
|
|
|
}
|
|
|
|
|
2017-12-06 13:03:06 +02:00
|
|
|
String getImageName() {
|
|
|
|
return imageName
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean isImagePulled() {
|
|
|
|
return imagePulled
|
|
|
|
}
|
|
|
|
|
|
|
|
String getParameters() {
|
|
|
|
return parameters
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|