Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dind setup for tests #8081

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pipeline {

def buildImage(baseImage) {
def scmvar = checkout(scm)
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def imageName = "dockerpinata/compose:${baseImage}-${scmvar.GIT_COMMIT}"
image = docker.image(imageName)

withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
Expand All @@ -89,7 +89,7 @@ def runTests(dockerVersion, pythonVersion, baseImage) {
stage("python=${pythonVersion} docker=${dockerVersion} ${baseImage}") {
node("ubuntu && amd64 && !zfs") {
def scmvar = checkout(scm)
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def imageName = "dockerpinata/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def storageDriver = sh(script: "docker info -f \'{{.Driver}}\'", returnStdout: true).trim()
echo "Using local system's storage driver: ${storageDriver}"
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
Expand All @@ -99,6 +99,8 @@ def runTests(dockerVersion, pythonVersion, baseImage) {
--privileged \\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need --privileged for this container? I see it bind-mounts docker.sock, which means that all docker commands will actually run against the docker daemon running on the host (not a dockerd daemon running inside the container (which would require privileged)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually wondering if we need a container here at all, because it's running a container, just to run a script, that uses the docker CLI inside the container to start new containers on the host 🤔

--volume="\$(pwd)/.git:/code/.git" \\
--volume="/var/run/docker.sock:/var/run/docker.sock" \\
--volume="\${DOCKER_CONFIG}/config.json:/code/.docker/config.json" \\
-e "DOCKER_TLS_CERTDIR=" \\
-e "TAG=${imageName}" \\
-e "STORAGE_DRIVER=${storageDriver}" \\
-e "DOCKER_VERSIONS=${dockerVersion}" \\
Expand Down
6 changes: 4 additions & 2 deletions Release.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pipeline {

def buildImage(baseImage) {
def scmvar = checkout(scm)
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def imageName = "dockerpinata/compose:${baseImage}-${scmvar.GIT_COMMIT}"
image = docker.image(imageName)

withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
Expand All @@ -249,7 +249,7 @@ def runTests(dockerVersion, pythonVersion, baseImage) {
stage("python=${pythonVersion} docker=${dockerVersion} ${baseImage}") {
node("linux && docker && ubuntu-2004 && cgroup1") {
def scmvar = checkout(scm)
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def imageName = "dockerpinata/compose:${baseImage}-${scmvar.GIT_COMMIT}"
def storageDriver = sh(script: "docker info -f \'{{.Driver}}\'", returnStdout: true).trim()
echo "Using local system's storage driver: ${storageDriver}"
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
Expand All @@ -259,6 +259,8 @@ def runTests(dockerVersion, pythonVersion, baseImage) {
--privileged \\
--volume="\$(pwd)/.git:/code/.git" \\
--volume="/var/run/docker.sock:/var/run/docker.sock" \\
--volume="\${DOCKER_CONFIG}/config.json:/code/.docker/config.json" \\
-e "DOCKER_TLS_CERTDIR=" \\
-e "TAG=${imageName}" \\
-e "STORAGE_DRIVER=${storageDriver}" \\
-e "DOCKER_VERSIONS=${dockerVersion}" \\
Expand Down
8 changes: 5 additions & 3 deletions script/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ for version in $DOCKER_VERSIONS; do

trap "on_exit" EXIT

repo="dockerswarm/dind"

docker run \
-d \
--name "$daemon_container" \
--privileged \
--volume="/var/lib/docker" \
"$repo:$version" \
-v $DOCKER_CONFIG/config.json:/code/.docker/config.json \
-e "DOCKER_TLS_CERTDIR=" \
"docker:$version-dind" \
dockerd -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \
2>&1 | tail -n 10

docker exec "$daemon_container" sh -c "apk add --no-cache git"

docker run \
--rm \
--tty \
Expand Down