Change in docker-playground[master]: jenkins-common.sh: pull upstream base images

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
Tue Apr 2 10:23:33 UTC 2019


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/13480 )

Change subject: jenkins-common.sh: pull upstream base images
......................................................................

jenkins-common.sh: pull upstream base images

Prevent building docker images on top of outdated Debian images, where
the package download feeds have been disabled. Use 'docker build --pull'
instead of 'docker build', whenever the "FROM" line in the Dockerfile
does not contain '$USER' (meaning this is an upstream image).

Checking the FROM line is necessary, as downloading '$USER' images will
fail (we never upload those).

Related: OS#3869
Change-Id: I1076bbb7d77bdc99f5d60d641c09ce965fb9dfc6
---
M jenkins-common.sh
M make/Makefile
2 files changed, 13 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  osmith: Verified



diff --git a/jenkins-common.sh b/jenkins-common.sh
index 2c4288e..a703a05 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -3,11 +3,21 @@
 }
 
 docker_images_require() {
+	local from_line
+	local pull_arg
+
 	for i in $@; do
 		# Trigger image build (cache will be used when up-to-date)
 		if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then
+			# Pull upstream base images
+			pull_arg="--pull"
+			from_line="$(grep '^FROM' ../$i/Dockerfile)"
+			if echo "$from_line" | grep -q '$USER'; then
+				pull_arg=""
+			fi
+
 			echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"
-			make -C "../$i" || exit 1
+			PULL="$pull_arg" make -C "../$i" || exit 1
 		fi
 
 		# Detect missing images (build skipped)
diff --git a/make/Makefile b/make/Makefile
index 2321fcf..d4e3c22 100644
--- a/make/Makefile
+++ b/make/Makefile
@@ -17,6 +17,7 @@
 USERNAME?=$(USER)
 NAME?=$(shell basename $(CURDIR))
 OSMO_TTCN3_BRANCH?=master
+PULL?=$(PULL)
 
 RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support
 IMAGE?=$(REGISTRY_HOST)/$(USER)/$(NAME)
@@ -41,7 +42,7 @@
 
 docker-build: .release
 	docker build --build-arg USER=$(USERNAME) --build-arg OSMO_TTCN3_BRANCH=$(OSMO_TTCN3_BRANCH) \
-		-t $(IMAGE):latest .
+		$(PULL) -t $(IMAGE):latest .
 	@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
 	DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \
 

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

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1076bbb7d77bdc99f5d60d641c09ce965fb9dfc6
Gerrit-Change-Number: 13480
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Daniel Willmann <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190402/9e0333fb/attachment.htm>


More information about the gerrit-log mailing list