From 63b4693e1f5dbc68c6433221ab59323633031faf Mon Sep 17 00:00:00 2001 From: Brian Satorius Date: Mon, 3 May 2021 20:47:35 -0700 Subject: [PATCH] Reattempt PREVIEW_URL fetch on failure --- entrypoint.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d8a19947..2866cb32 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -35,15 +35,23 @@ for endpoint in endpoints: END } -PREVIEW_URL=$(get_workspace_url_prefix "$CHE_WORKSPACE_NAMESPACE-che") # Che 7 OPS configuration where the (actual) namespace is "-che" -if test -z "$PREVIEW_URL" -then - PREVIEW_URL=$(get_workspace_url_prefix "$CHE_WORKSPACE_NAMESPACE-$CHE_WORKSPACE_ID") # Che 7 UAT configuration fallback where the default namespace is "-", this will be deprecated -fi -if test -z "$PREVIEW_URL" -then - PREVIEW_URL=$(get_workspace_url_prefix "$CHE_WORKSPACE_ID") # Che 6 configuration fallback where the default namespace is the workspace id, this will be deprecated -fi +for i in {0..20} +do + echo "Attempt $i to construct PREVIEW_URL" + PREVIEW_URL=$(get_workspace_url_prefix "$CHE_WORKSPACE_NAMESPACE-che") # Che 7 OPS configuration where the (actual) namespace is "-che" + if test -z "$PREVIEW_URL" + then + PREVIEW_URL=$(get_workspace_url_prefix "$CHE_WORKSPACE_NAMESPACE-$CHE_WORKSPACE_ID") # Che 7 UAT configuration fallback where the default namespace is "-", this will be deprecated + fi + if test -z "$PREVIEW_URL" + then + PREVIEW_URL=$(get_workspace_url_prefix "$CHE_WORKSPACE_ID") # Che 6 configuration fallback where the default namespace is the workspace id, this will be deprecated + fi + if ! test -z "$PREVIEW_URL" # exit loop when it has a preview_url + then + break + fi +done # Fix Jupyterlab for Che in `single-host` mode. In `single-host` mode, Che uses URL path prefixes # to distinguish workspaces. So for example, `https:///work/space/path/`.