Change in docker-playground[master]: Add retries for downloading debian "Release" file

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Thu May 2 14:45:01 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13848


Change subject: Add retries for downloading debian "Release" file
......................................................................

Add retries for downloading debian "Release" file

Use wget to download the "Release" file outside of the Dockerfile, then
add the local file to the docker image, to make docker use its cache if
the file did not change.

Change-Id: Ib7c0ffd1e938349f2e1478d833abd351bc886bed
---
M .gitignore
M debian-jessie-build/Dockerfile
M debian-stretch-build/Dockerfile
M jenkins-common.sh
4 files changed, 31 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/48/13848/1

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 @@
 
 MAINTAINER Harald Welte <laforge at 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 @@
 
 MAINTAINER Harald Welte <laforge at 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 @@
 	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 @@
 				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

-- 
To view, visit https://gerrit.osmocom.org/13848
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7c0ffd1e938349f2e1478d833abd351bc886bed
Gerrit-Change-Number: 13848
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190502/78a8ff3b/attachment.htm>


More information about the gerrit-log mailing list