Handled the delay in chartmuseum server initialization 68/5768/1
authorAlok Bhatt <alok_bh@hcl.com>
Tue, 16 Mar 2021 06:04:33 +0000 (06:04 +0000)
committerAlok Bhatt <alok_bh@hcl.com>
Tue, 16 Mar 2021 06:04:33 +0000 (06:04 +0000)
Wait for chartmuseum server init & graceful exit after 5 retries

Issue-Id: RIC-762

Signed-off-by: Alok Bhatt <alok_bh@hcl.com>
Change-Id: I0c465549531521650db7352935e2dbd771f32ed9

bin/prepare-common-templates

index bfdd3d2..8743260 100755 (executable)
@@ -35,6 +35,18 @@ then
     fi
 fi
 
+# Check if servecm plugin is ready to serve request
+command='curl --silent --output /dev/null  http://127.0.0.1:8879/charts'
+for i in $(seq 1 5)
+do $command && s=0 && break || s=$? && echo "Error connecting chartmuseum server. Retrying after 5s" && sleep 5;
+done
+
+if [ $s -gt 0 ]
+then
+        echo "Cmd to test chartmuseum failed with ($s): $command"
+        exit $s
+fi
+
 # Package common templates and serve it using Helm local repo
 if [ $IS_HELM3 ]
 then