<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13480">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">jenkins-common.sh: pull upstream base images<br><br>Prevent building docker images on top of outdated Debian images, where<br>the package download feeds have been disabled. Use 'docker build --pull'<br>instead of 'docker build', whenever the "FROM" line in the Dockerfile<br>does not contain '$USER' (meaning this is an upstream image).<br><br>Related: OS#3869<br>Change-Id: I1076bbb7d77bdc99f5d60d641c09ce965fb9dfc6<br>---<br>M jenkins-common.sh<br>M make/Makefile<br>2 files changed, 13 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/80/13480/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/jenkins-common.sh b/jenkins-common.sh</span><br><span>index 2c4288e..a703a05 100644</span><br><span>--- a/jenkins-common.sh</span><br><span>+++ b/jenkins-common.sh</span><br><span>@@ -3,11 +3,21 @@</span><br><span> }</span><br><span> </span><br><span> docker_images_require() {</span><br><span style="color: hsl(120, 100%, 40%);">+     local from_line</span><br><span style="color: hsl(120, 100%, 40%);">+       local pull_arg</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     for i in $@; do</span><br><span>              # Trigger image build (cache will be used when up-to-date)</span><br><span>           if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                    # Pull upstream base images</span><br><span style="color: hsl(120, 100%, 40%);">+                   pull_arg="--pull"</span><br><span style="color: hsl(120, 100%, 40%);">+                   from_line="$(grep '^FROM' ../$i/Dockerfile)"</span><br><span style="color: hsl(120, 100%, 40%);">+                        if echo "$from_line" | grep -q '$USER'; then</span><br><span style="color: hsl(120, 100%, 40%);">+                                pull_arg=""</span><br><span style="color: hsl(120, 100%, 40%);">+                 fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>                         echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"</span><br><span style="color: hsl(0, 100%, 40%);">-                    make -C "../$i" || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+                   PULL="$pull_arg" make -C "../$i" || exit 1</span><br><span>               fi</span><br><span> </span><br><span>               # Detect missing images (build skipped)</span><br><span>diff --git a/make/Makefile b/make/Makefile</span><br><span>index 2321fcf..d4e3c22 100644</span><br><span>--- a/make/Makefile</span><br><span>+++ b/make/Makefile</span><br><span>@@ -17,6 +17,7 @@</span><br><span> USERNAME?=$(USER)</span><br><span> NAME?=$(shell basename $(CURDIR))</span><br><span> OSMO_TTCN3_BRANCH?=master</span><br><span style="color: hsl(120, 100%, 40%);">+PULL?=$(PULL)</span><br><span> </span><br><span> RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support</span><br><span> IMAGE?=$(REGISTRY_HOST)/$(USER)/$(NAME)</span><br><span>@@ -41,7 +42,7 @@</span><br><span> </span><br><span> docker-build: .release</span><br><span>     docker build --build-arg USER=$(USERNAME) --build-arg OSMO_TTCN3_BRANCH=$(OSMO_TTCN3_BRANCH) \</span><br><span style="color: hsl(0, 100%, 40%);">-          -t $(IMAGE):latest .</span><br><span style="color: hsl(120, 100%, 40%);">+          $(PULL) -t $(IMAGE):latest .</span><br><span>         @DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \</span><br><span>   DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13480">change 13480</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13480"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: docker-playground </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I1076bbb7d77bdc99f5d60d641c09ce965fb9dfc6 </div>
<div style="display:none"> Gerrit-Change-Number: 13480 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>