<p>Hoernchen has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/docker-playground/+/14679">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">clean up the net and attached containers to ensure reliable test starts<br><br>We can't create the net if it exists, and it can't be removed until all<br>attached containers are dead, so ensure this is the case upon net<br>creation. This fixes test failures due to stale nets and half-killed<br>test runs.<br><br>Change-Id: Id6d13b233ebfd808d8dfe83b6d1d1ba20c3392c8<br>---<br>M jenkins-common.sh<br>1 file changed, 10 insertions(+), 0 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/79/14679/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 25ae26f..9fd3857 100644</span><br><span>--- a/jenkins-common.sh</span><br><span>+++ b/jenkins-common.sh</span><br><span>@@ -28,8 +28,18 @@</span><br><span>     done</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#kills all containers attached to network</span><br><span style="color: hsl(120, 100%, 40%);">+network_clean() {</span><br><span style="color: hsl(120, 100%, 40%);">+   docker network inspect $NET_NAME | grep Name | cut -d : -f2 | awk -F\" 'NR>1{print $2}' | xargs -rn1 docker kill</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> network_create() {</span><br><span>  NET=$1</span><br><span style="color: hsl(120, 100%, 40%);">+        if docker network ls | grep -q $NET_NAME; then</span><br><span style="color: hsl(120, 100%, 40%);">+                echo removing stale network and containers...</span><br><span style="color: hsl(120, 100%, 40%);">+         network_clean</span><br><span style="color: hsl(120, 100%, 40%);">+         network_remove</span><br><span style="color: hsl(120, 100%, 40%);">+        fi</span><br><span>   echo Creating network $NET_NAME</span><br><span>      docker network create --internal --subnet $NET $NET_NAME</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/docker-playground/+/14679">change 14679</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/c/docker-playground/+/14679"/><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-Change-Id: Id6d13b233ebfd808d8dfe83b6d1d1ba20c3392c8 </div>
<div style="display:none"> Gerrit-Change-Number: 14679 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Hoernchen <ewild@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>