Update patch_module to allow push to ttl.sh 01/14601/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 25 Sep 2024 14:36:24 +0000 (16:36 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 25 Sep 2024 14:36:24 +0000 (16:36 +0200)
Change-Id: Iab5ac29525145bb05edf0ec4b437b135faf464c1
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
tools/patch_module.sh

index fb697ac..365bb42 100755 (executable)
 
 if [ $# -ne 2 ]; then
     echo "Usage $0 <module> <tag_number>"
-    echo "Example: $0 ro 2"
-    echo "Example: $0 lcm 5"
+    echo "    Example: $0 ro 2"
+    echo "        Will import image in containerd local registry as opensourcemano/ro:devel-2"
+    echo "    Example: $0 lcm 5"
+    echo "        Will import image in containerd local registry as opensourcemano/lcm:devel-5"
+    echo "    Example: $0 osm-krm-functions 24h"
+    echo "        (when tag_number is '[0-9]+h') Will push the image to ttl.sh/osm-krm-functions-devel:24h"
     exit 1
 fi
 
@@ -27,6 +31,16 @@ MODULE_NAME="$1"
 TAG_NUMBER="$2"
 
 set -x
+
+if [[ "${TAG_NUMBER}" =~ ^[0-9]+h$ ]]; then
+    IMAGE_NAME="ttl.sh/${MODULE_NAME}-devel:${TAG_NUMBER}"
+    docker tag opensourcemano/${MODULE_NAME}:devel ${IMAGE_NAME}
+    docker push ${IMAGE_NAME}
+    exit 0
+else
+    echo "Image will be imported locally"
+fi
+
 IMAGE_NAME="opensourcemano/${MODULE_NAME}:devel-${TAG_NUMBER}"
 docker tag opensourcemano/${MODULE_NAME}:devel ${IMAGE_NAME}
 IMAGE_FILE="${MODULE_NAME}-devel-${TAG_NUMBER}.tar.gz"