Skip to content

Commit

Permalink
docker binary isn't installed in the jenkins-dsl-ready image anymore
Browse files Browse the repository at this point in the history
binary just need to be mounted with a docker volume at run time
  • Loading branch information
thomasleveil committed Sep 7, 2015
1 parent 3ee0d0c commit daa3ea1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 15 deletions.
7 changes: 0 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ FROM jenkins

USER root

# Install docker, so docker commands can be used in jobs
ENV DOCKER_VERSION 1.8.1
RUN curl -sSL https://get.docker.com/builds/Linux/x86_64/docker-$DOCKER_VERSION > /usr/bin/docker \
&& groupadd docker \
&& chmod 0755 /usr/bin/docker \
&& usermod -a -G docker jenkins

# Install sudo to enpower jenkins (will be usefull for running docker in some cases)
RUN apt-get update \
&& apt-get install -y sudo \
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Using the [dockerswarm/dind][dind] image, you can start a container which run an
You would then start the jenkins-dsl-ready container with:

docker run -d \
-v $(which docker):/usr/bin/docker:ro \
-p 8080:8080 \
--link dind:dind \
-e DOCKER_HOST=tcp://dind:2375 \
Expand All @@ -130,6 +131,7 @@ In the end, the command to run such a container is:
docker run -d \
-u root \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker:ro \
-p 8080:8080 \
--name jenkins \
tomdesinto/jenkins-dsl-ready
Expand All @@ -143,6 +145,7 @@ Same as method 2, but we don't run Jenkins as _root_. In this case the Jenkins j

docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker:ro \
-p 8080:8080 \
--name jenkins \
tomdesinto/jenkins-dsl-ready
Expand Down
2 changes: 1 addition & 1 deletion tests/SEEDJOB_GIT.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GIT_CONTAINER=bats-git
load test_helpers
load jenkins_helpers

@test "clean test containers" {
@test "------ preparing $(basename $BATS_TEST_FILENAME .bats) ------" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
docker kill $GIT_CONTAINER &>/dev/null ||:
Expand Down
2 changes: 1 addition & 1 deletion tests/SEEDJOB_SVN.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SVN_CONTAINER=bats-svn
load test_helpers
load jenkins_helpers

@test "clean test containers" {
@test "------ preparing $(basename $BATS_TEST_FILENAME .bats) ------" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
docker kill $SVN_CONTAINER &>/dev/null ||:
Expand Down
2 changes: 1 addition & 1 deletion tests/default.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SUT_CONTAINER=bats-jenkins
load test_helpers
load jenkins_helpers

@test "clean test containers" {
@test "------ preparing $(basename $BATS_TEST_FILENAME .bats) ------" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
}
Expand Down
5 changes: 3 additions & 2 deletions tests/job-using-dind.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DIND_CONTAINER=bats-dind
load test_helpers
load jenkins_helpers

@test "clean test containers" {
@test "------ preparing $(basename $BATS_TEST_FILENAME .bats) ------" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
docker kill $DIND_CONTAINER &>/dev/null ||:
Expand All @@ -27,13 +27,14 @@ load jenkins_helpers
}

@test "dind container is functionnal" {
docker exec $DIND_CONTAINER docker version
retry 3 1 docker exec $DIND_CONTAINER docker version
}

@test "SUT container with dind capabilities created" {
docker run -d --name $SUT_CONTAINER \
--link $DIND_CONTAINER:dind \
-e DOCKER_HOST=tcp://dind:2375 \
-v $(which docker):/usr/bin/docker:ro \
-v $BATS_TEST_DIRNAME/resources/dsl-job-using-docker/:/usr/share/jenkins/ref/jobs/SeedJob/workspace/:ro \
-P \
tomdesinto/jenkins-dsl-ready
Expand Down
3 changes: 2 additions & 1 deletion tests/job-using-docker.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SUT_CONTAINER=bats-jenkins-docker
load test_helpers
load jenkins_helpers

@test "clean test containers" {
@test "------ preparing $(basename $BATS_TEST_FILENAME .bats) ------" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
}
Expand All @@ -15,6 +15,7 @@ load jenkins_helpers
-v $BATS_TEST_DIRNAME/resources/dsl-job-using-docker/:/usr/share/jenkins/ref/jobs/SeedJob/workspace/:ro \
-P \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker:ro \
-u root \
tomdesinto/jenkins-dsl-ready
}
Expand Down
4 changes: 2 additions & 2 deletions tests/job-using-sudo-docker.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SUT_CONTAINER=bats-jenkins-sudo-docker
load test_helpers
load jenkins_helpers

@test "clean test containers" {
@test "------ preparing $(basename $BATS_TEST_FILENAME .bats) ------" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
}
Expand All @@ -15,7 +15,7 @@ load jenkins_helpers
-v $BATS_TEST_DIRNAME/resources/dsl-job-using-sudo-docker/:/usr/share/jenkins/ref/jobs/SeedJob/workspace/:ro \
-P \
-v /var/run/docker.sock:/var/run/docker.sock \
-u root \
-v $(which docker):/usr/bin/docker:ro \
tomdesinto/jenkins-dsl-ready
}

Expand Down

0 comments on commit daa3ea1

Please sign in to comment.