aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-05-02 16:21:23 +0200
committerOliver Smith <osmith@sysmocom.de>2019-05-02 16:21:23 +0200
commit96c0d15fae2fdecde3aa5e5c59b994425eb5ee2c (patch)
tree74db6b5c39bb1536a8bfa6c4ef4661b0b9ffe7a8
parentdf7d1bc2608472adadf7b30861872b4146f44de4 (diff)
retry release downloadosmith/retry-release-download
-rw-r--r--.gitignore3
-rw-r--r--debian-jessie-build/Dockerfile4
-rw-r--r--debian-stretch-build/Dockerfile4
-rw-r--r--jenkins-common.sh22
4 files changed, 31 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index a16a1a0..ea885c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
.release
+
+# See download_debian_repo_release_with_retries() in jenkins-common.sh
+Release
diff --git a/debian-jessie-build/Dockerfile b/debian-jessie-build/Dockerfile
index 29daff6..9d85ec9 100644
--- a/debian-jessie-build/Dockerfile
+++ b/debian-jessie-build/Dockerfile
@@ -2,7 +2,9 @@ FROM debian:jessie
MAINTAINER Harald Welte <laforge@gnumonks.org>
-ADD http://ftp.debian.org/debian/dists/jessie/Release /tmp/Release
+# See download_debian_repo_release_with_retries() in jenkins-common.sh
+ADD Release /tmp/Release
+
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
diff --git a/debian-stretch-build/Dockerfile b/debian-stretch-build/Dockerfile
index e262d86..1fc43a9 100644
--- a/debian-stretch-build/Dockerfile
+++ b/debian-stretch-build/Dockerfile
@@ -2,7 +2,9 @@ FROM debian:stretch
MAINTAINER Harald Welte <laforge@gnumonks.org>
-ADD http://ftp.debian.org/debian/dists/stretch/Release /tmp/Release
+# See download_debian_repo_release_with_retries() in jenkins-common.sh
+ADD Release /tmp/Release
+
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
diff --git a/jenkins-common.sh b/jenkins-common.sh
index a703a05..37b574a 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -2,6 +2,26 @@ docker_image_exists() {
test -n "$(docker images -q "$REPO_USER/$1")"
}
+# Have multiple attempts at downloading the "Release" file for the base debian images (debian-*-build), upon which all
+# practically used images in docker-playground.git are based on. We copy that file into the docker image, to let it
+# invalidate the cache after each release. Due to frequent download errors, we need to have the retry functionallity.
+# $1: docker image name (e.g. "debian-stretch-build")
+download_debian_repo_release_with_retries() {
+ local url=""
+ case "$1" in
+ debian-stretch-build)
+ url="http://ftp.debian.org/debian/dists/stretch/Release"
+ ;;
+ debian-jessie-build)
+ url="http://ftp.debian.org/debian/dists/jessie/Release"
+ ;;
+ *)
+ return
+ ;;
+ esac
+ wget --tries=10 "$url" -O "../$1/Release"
+}
+
docker_images_require() {
local from_line
local pull_arg
@@ -16,6 +36,8 @@ docker_images_require() {
pull_arg=""
fi
+ download_debian_repo_release_with_retries "$i"
+
echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"
PULL="$pull_arg" make -C "../$i" || exit 1
fi