Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Reattempt PREVIEW_URL fetch on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bsatoriu committed May 4, 2021
1 parent d71a84f commit 63b4693
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<username>-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 "<username>-<workspaceid>", 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 "<username>-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 "<username>-<workspaceid>", 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://<host>/work/space/path/<jupyter endpoints>`.
Expand Down

0 comments on commit 63b4693

Please sign in to comment.