<p>osmith <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/11365">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Harald Welte: Looks good to me, approved
  osmith: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">jenkins-common.sh: add docker_images_require()<br><br>This new function can be used on top of each *-test/jenkins.sh to<br>automatically build the required Docker images before starting a<br>testsuite.<br><br>The top-level Makefile should also be able to build all Docker images<br>on which a job depends. But in that Makefile the list of dependencies<br>can not be specified dynamically, as it will be necessary for OS#3268:<br>ttcn3-mgw-test may depend on osmo-mgw-latest or on osmo-mgw-master.<br><br>This will be used by Idbb708ab16cb71bab5069127945b63388222369e.<br><br>Related: OS#3268<br>Change-Id: I0afdf3400282634fca9b31d57eaeedd6b5c28aa1<br>---<br>M jenkins-common.sh<br>1 file changed, 19 insertions(+), 0 deletions(-)<br><br></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 515479f..f3d6c61 100644</span><br><span>--- a/jenkins-common.sh</span><br><span>+++ b/jenkins-common.sh</span><br><span>@@ -1,3 +1,22 @@</span><br><span style="color: hsl(120, 100%, 40%);">+docker_image_exists() {</span><br><span style="color: hsl(120, 100%, 40%);">+ test -n "$(docker images -q "$REPO_USER/$1")"</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+docker_images_require() {</span><br><span style="color: hsl(120, 100%, 40%);">+     for i in $@; do</span><br><span style="color: hsl(120, 100%, 40%);">+               # Trigger image build (cache will be used when up-to-date)</span><br><span style="color: hsl(120, 100%, 40%);">+            if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+                    echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"</span><br><span style="color: hsl(120, 100%, 40%);">+                  make -C "../$i"</span><br><span style="color: hsl(120, 100%, 40%);">+             fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+          # Detect missing images (build skipped/failure)</span><br><span style="color: hsl(120, 100%, 40%);">+               if ! docker_image_exists "$i"; then</span><br><span style="color: hsl(120, 100%, 40%);">+                 echo "ERROR: missing image: $i"</span><br><span style="color: hsl(120, 100%, 40%);">+                     exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+                fi</span><br><span style="color: hsl(120, 100%, 40%);">+    done</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span> </span><br><span> network_create() {</span><br><span>    NET=$1</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11365">change 11365</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/11365"/><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: merged </div>
<div style="display:none"> Gerrit-Change-Id: I0afdf3400282634fca9b31d57eaeedd6b5c28aa1 </div>
<div style="display:none"> Gerrit-Change-Number: 11365 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>