Skip to content
This repository was archived by the owner on May 4, 2021. It is now read-only.

Commit afb6ca8

Browse files
committed
Merge pull request #78 from tutumcloud/staging
v0.21.0
2 parents ea3299a + a5d0dda commit afb6ca8

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MAINTAINER [email protected]
44
RUN apt-get update && \
55
DEBIAN_FRONTEND=noninteractive apt-get install -yq iptables apt-transport-https ca-certificates ssh git curl make
66

7-
ENV DIND_COMMIT=b8bed8832b77a478360ae946a69dab5e922b194e DOCKER_VERSION=1.8.3 COMPOSE_VERSION=1.3.3
7+
ENV DIND_COMMIT=b8bed8832b77a478360ae946a69dab5e922b194e DOCKER_VERSION=1.9.1 COMPOSE_VERSION=1.5.2
88
ADD https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION} /usr/bin/docker
99
ADD https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind /usr/local/bin/dind
1010
ADD https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-linux-x86_64 /usr/local/bin/docker-compose

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,4 @@ If you want to use the host docker daemon instead of letting the container run i
123123

124124
## Disable recursive strategy on git clone
125125

126-
In some cases, you may need set up credentials for the initialization github submodules, and it may make `git clone --recursive` fail. In such a case, you can disable the default `--recuresive` strategy by setting `-e GIT_CLONE_OPTS=""` and do `git submodule init & git submodule update` manually in `hooks/post_checkout` or `hooks/pre_build`.
126+
In some cases, you may need set up credentials for the initialization github submodules, and it may make `git clone --recursive` fail. In such a case, you can disable the default `--recursive` strategy by setting `-e GIT_CLONE_OPTS=""` and do `git submodule init & git submodule update` manually in `hooks/post_checkout` or `hooks/pre_build`.

build.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ print_msg "=> Detecting application"
5555
if [ ! -d /app ]; then
5656
if [ ! -z "$GIT_REPO" ]; then
5757
if [ ! -z "$GIT_ID_RSA" ]; then
58-
echo -e "$GIT_ID_RSA" > /root/.ssh/id_rsa
58+
echo -e "$GIT_ID_RSA" > ~/.ssh/id_rsa
5959
chmod 400 ~/.ssh/id_rsa
6060
fi
6161
print_msg " Cloning repo from ${GIT_REPO##*@}"
6262
git clone ${GIT_CLONE_OPTS} $GIT_REPO /src
63+
if [ ! -z "$GIT_ID_RSA" ]; then
64+
rm -f ~/.ssh/id_rsa
65+
unset GIT_ID_RSA
66+
fi
6367
if [ $? -ne 0 ]; then
6468
print_msg " ERROR: Error cloning $GIT_REPO"
6569
exit 1
@@ -94,7 +98,6 @@ if [ ! -f Dockerfile ]; then
9498
echo "FROM tutum/buildstep" >> Dockerfile
9599
fi
96100

97-
98101
#
99102
# (1/3) Build step
100103
#
@@ -167,7 +170,15 @@ if [ ! -z "$IMAGE_NAME" ]; then
167170
run_hook push
168171
else
169172
docker tag -f this $IMAGE_NAME
170-
docker push $IMAGE_NAME
173+
RETRIES=${RETRIES:-5}
174+
for (( i=0 ; ; i++ )); do
175+
if [ ${i} -eq ${RETRIES} ]; then
176+
echo "Too many retries: failed to push the image ${IMAGE_NAME}"
177+
exit 1
178+
fi
179+
docker push $IMAGE_NAME && break
180+
sleep 1
181+
done
171182
# docker push $IMAGE_NAME 2>&1 | tee /tmp/push-result || true
172183
# while cat /tmp/push-result | grep -q "is already in progress"; do
173184
# docker push $IMAGE_NAME 2>&1 | tee /tmp/push-result || true
@@ -198,7 +209,7 @@ cat <<EOF
198209
Build summary
199210
=============
200211
201-
$DOCKER_USED
212+
$DOCKER_USED and docker-compose ${COMPOSE_VERSION}
202213
$SOURCE
203214
$BUILD
204215
$TEST

run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ if [ -S /var/run/docker.sock ]; then
5656
if ! docker version > /dev/null 2>&1 ; then
5757
export DOCKER_VERSION=$(cat version_list | grep -P "^$(docker version 2>&1 > /dev/null | grep -iF "client and server don't have same version" | grep -oP 'server: *\d*\.\d*' | grep -oP '\d*\.\d*') .*$" | cut -d " " -f2)
5858
if [ "${DOCKER_VERSION}" != "" ]; then
59-
print_msg "=> Downloading Docker ${DOCKER_VERSION}"
59+
print_msg "=> Downloading docker ${DOCKER_VERSION}"
6060
curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}
6161
fi
6262
fi
6363
docker version > /dev/null 2>&1 || { print_msg " Failed to connect to docker daemon at /var/run/docker.sock" && exit 1; }
6464
EXTERNAL_DOCKER=yes
65-
DOCKER_USED="Using external docker version ${DOCKER_VERSION} mounted at /var/run/docker.sock"
65+
DOCKER_USED="Using external docker ${DOCKER_VERSION} mounted at /var/run/docker.sock"
6666
export DOCKER_USED=${DOCKER_USED}
6767
export EXTERNAL_DOCKER=${EXTERNAL_DOCKER}
6868
export MOUNTED_DOCKER_FOLDER=${MOUNTED_DOCKER_FOLDER}
6969
/build.sh "$@"
7070
else
71-
DOCKER_USED="Using docker-in-docker"
71+
DOCKER_USED="Using docker-in-docker ${DOCKER_VERSION}"
7272
if [ "$(ls -A /var/lib/docker)" ]; then
7373
print_msg "=> Detected pre-existing /var/lib/docker folder"
7474
MOUNTED_DOCKER_FOLDER=yes

0 commit comments

Comments
 (0)