From b94dd3fa39439ca974c899a1b0cb14b7e6ce52fb Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 1 Sep 2021 17:47:34 +0300
Subject: [PATCH] Small fix for update-wb.

In case the image or the toolbox container aren't present, download the
image and then return that the image isn't the latest (causing a new
container to be created).
---
 Documents/bin/update-wb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documents/bin/update-wb b/Documents/bin/update-wb
index ac45658..ffe0645 100755
--- a/Documents/bin/update-wb
+++ b/Documents/bin/update-wb
@@ -5,8 +5,12 @@ IMAGE='registry.shore.co.il/workbench'
 CONTAINER='workbench'
 
 is_latest() {
-    podman image exists "$IMAGE" || return 1
-    toolbox run --container "$CONTAINER" true 2>/dev/null || return 1
+    if ! podman image exists "$IMAGE" ||
+        ! toolbox run --container "$CONTAINER" true 2>/dev/null
+    then
+        podman image pull "$IMAGE" || exit 1
+        return 1
+    fi
     current="$(podman container inspect "$CONTAINER" --format '{{ .Image }}')"
     podman image pull "$IMAGE" > /dev/null
     new="$(podman image inspect "$IMAGE" --format '{{.Digest}}')"
-- 
GitLab