mirror of https://github.com/docker/docker-py.git
Merge pull request #2705 from aiordache/jenkins_dockerhub_creds
Update Jenkinsfile with docker registry credentials
This commit is contained in:
commit
4328197660
|
@ -25,10 +25,11 @@ def buildImages = { ->
|
||||||
imageNamePy2 = "${imageNameBase}:py2-${gitCommit()}"
|
imageNamePy2 = "${imageNameBase}:py2-${gitCommit()}"
|
||||||
imageNamePy3 = "${imageNameBase}:py3-${gitCommit()}"
|
imageNamePy3 = "${imageNameBase}:py3-${gitCommit()}"
|
||||||
imageDindSSH = "${imageNameBase}:sshdind-${gitCommit()}"
|
imageDindSSH = "${imageNameBase}:sshdind-${gitCommit()}"
|
||||||
|
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
|
||||||
buildImage(imageDindSSH, "-f tests/Dockerfile-ssh-dind .", "")
|
buildImage(imageDindSSH, "-f tests/Dockerfile-ssh-dind .", "")
|
||||||
buildImage(imageNamePy2, "-f tests/Dockerfile --build-arg PYTHON_VERSION=2.7 .", "py2.7")
|
buildImage(imageNamePy2, "-f tests/Dockerfile --build-arg PYTHON_VERSION=2.7 .", "py2.7")
|
||||||
buildImage(imageNamePy3, "-f tests/Dockerfile --build-arg PYTHON_VERSION=3.7 .", "py3.7")
|
buildImage(imageNamePy3, "-f tests/Dockerfile --build-arg PYTHON_VERSION=3.7 .", "py3.7")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,41 +83,44 @@ def runTests = { Map settings ->
|
||||||
def dindContainerName = "dpy-dind-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
|
def dindContainerName = "dpy-dind-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
|
||||||
def testContainerName = "dpy-tests-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
|
def testContainerName = "dpy-tests-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
|
||||||
def testNetwork = "dpy-testnet-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
|
def testNetwork = "dpy-testnet-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
|
||||||
try {
|
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
|
||||||
sh """docker network create ${testNetwork}"""
|
try {
|
||||||
sh """docker run --rm -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
|
sh """docker network create ${testNetwork}"""
|
||||||
${imageDindSSH} dockerd -H tcp://0.0.0.0:2375
|
sh """docker run --rm -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
|
||||||
"""
|
${imageDindSSH} dockerd -H tcp://0.0.0.0:2375
|
||||||
sh """docker run --rm \\
|
"""
|
||||||
--name ${testContainerName} \\
|
sh """docker run --rm \\
|
||||||
-e "DOCKER_HOST=tcp://${dindContainerName}:2375" \\
|
--name ${testContainerName} \\
|
||||||
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
|
-e "DOCKER_HOST=tcp://${dindContainerName}:2375" \\
|
||||||
--network ${testNetwork} \\
|
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
|
||||||
--volumes-from ${dindContainerName} \\
|
--network ${testNetwork} \\
|
||||||
${testImage} \\
|
--volumes-from ${dindContainerName} \\
|
||||||
py.test -v -rxs --cov=docker --ignore=tests/ssh tests/
|
-v ~/.docker/config.json:/root/.docker/config.json \\
|
||||||
"""
|
${testImage} \\
|
||||||
sh """docker stop ${dindContainerName}"""
|
py.test -v -rxs --cov=docker --ignore=tests/ssh tests/
|
||||||
|
"""
|
||||||
// start DIND container with SSH
|
sh """docker stop ${dindContainerName}"""
|
||||||
sh """docker run --rm -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
|
// start DIND container with SSH
|
||||||
${imageDindSSH} dockerd --experimental"""
|
sh """docker run --rm -d --name ${dindContainerName} -v /tmp --privileged --network ${testNetwork} \\
|
||||||
sh """docker exec ${dindContainerName} sh -c /usr/sbin/sshd """
|
${imageDindSSH} dockerd --experimental"""
|
||||||
// run SSH tests only
|
sh """docker exec ${dindContainerName} sh -c /usr/sbin/sshd """
|
||||||
sh """docker run --rm \\
|
// run SSH tests only
|
||||||
--name ${testContainerName} \\
|
sh """docker run --rm \\
|
||||||
-e "DOCKER_HOST=ssh://${dindContainerName}:22" \\
|
--name ${testContainerName} \\
|
||||||
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
|
-e "DOCKER_HOST=ssh://${dindContainerName}:22" \\
|
||||||
--network ${testNetwork} \\
|
-e 'DOCKER_TEST_API_VERSION=${apiVersion}' \\
|
||||||
--volumes-from ${dindContainerName} \\
|
--network ${testNetwork} \\
|
||||||
${testImage} \\
|
--volumes-from ${dindContainerName} \\
|
||||||
py.test -v -rxs --cov=docker tests/ssh
|
-v ~/.docker/config.json:/root/.docker/config.json \\
|
||||||
"""
|
${testImage} \\
|
||||||
} finally {
|
py.test -v -rxs --cov=docker tests/ssh
|
||||||
sh """
|
"""
|
||||||
docker stop ${dindContainerName}
|
} finally {
|
||||||
docker network rm ${testNetwork}
|
sh """
|
||||||
"""
|
docker stop ${dindContainerName}
|
||||||
|
docker network rm ${testNetwork}
|
||||||
|
"""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue