Skip to content

Commit

Permalink
added conditions in start custom script
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis-marcotte committed Oct 24, 2024
1 parent f3c46eb commit 06467f1
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 152 deletions.
50 changes: 31 additions & 19 deletions output/docker-stacks-datascience-notebook/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ else
fi

# Step up Git Credential Manager
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc

# Clone example notebooks (with retries)
RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
if [[ ! -z "${GPG_TTY}" ]]; then
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
fi

# Clone example notebooks (with retries because it sometimes initially fails)
if [[ ! -d ~/aaw-contrib-jupyter-notebooks]]; then
echo "Cloning examples notebooks"

RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
else
echo "Example notebooks already cloned."
fi

if [ ! -e /home/$NB_USER/.Rprofile ]; then
cat /tmp/.Rprofile >> /home/$NB_USER/.Rprofile && rm -rf /tmp/.Rprofile
Expand All @@ -51,11 +59,15 @@ fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
if [ ! -f /home/$NB_USER/.local/bin/rm ]; then
echo "adding rm wrapper"

mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
fi

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"
Expand Down
50 changes: 31 additions & 19 deletions output/jupyterlab-cpu/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ else
fi

# Step up Git Credential Manager
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc

# Clone example notebooks (with retries)
RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
if [[ ! -z "${GPG_TTY}" ]]; then
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
fi

# Clone example notebooks (with retries because it sometimes initially fails)
if [[ ! -d ~/aaw-contrib-jupyter-notebooks]]; then
echo "Cloning examples notebooks"

RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
else
echo "Example notebooks already cloned."
fi

if [ ! -e /home/$NB_USER/.Rprofile ]; then
cat /tmp/.Rprofile >> /home/$NB_USER/.Rprofile && rm -rf /tmp/.Rprofile
Expand All @@ -51,11 +59,15 @@ fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
if [ ! -f /home/$NB_USER/.local/bin/rm ]; then
echo "adding rm wrapper"

mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
fi

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"
Expand Down
50 changes: 31 additions & 19 deletions output/jupyterlab-pytorch/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ else
fi

# Step up Git Credential Manager
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc

# Clone example notebooks (with retries)
RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
if [[ ! -z "${GPG_TTY}" ]]; then
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
fi

# Clone example notebooks (with retries because it sometimes initially fails)
if [[ ! -d ~/aaw-contrib-jupyter-notebooks]]; then
echo "Cloning examples notebooks"

RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
else
echo "Example notebooks already cloned."
fi

if [ ! -e /home/$NB_USER/.Rprofile ]; then
cat /tmp/.Rprofile >> /home/$NB_USER/.Rprofile && rm -rf /tmp/.Rprofile
Expand All @@ -51,11 +59,15 @@ fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
if [ ! -f /home/$NB_USER/.local/bin/rm ]; then
echo "adding rm wrapper"

mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
fi

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"
Expand Down
50 changes: 31 additions & 19 deletions output/jupyterlab-tensorflow/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ else
fi

# Step up Git Credential Manager
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc

# Clone example notebooks (with retries)
RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
if [[ ! -z "${GPG_TTY}" ]]; then
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
fi

# Clone example notebooks (with retries because it sometimes initially fails)
if [[ ! -d ~/aaw-contrib-jupyter-notebooks]]; then
echo "Cloning examples notebooks"

RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
else
echo "Example notebooks already cloned."
fi

if [ ! -e /home/$NB_USER/.Rprofile ]; then
cat /tmp/.Rprofile >> /home/$NB_USER/.Rprofile && rm -rf /tmp/.Rprofile
Expand All @@ -51,11 +59,15 @@ fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
if [ ! -f /home/$NB_USER/.local/bin/rm ]; then
echo "adding rm wrapper"

mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
fi

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"
Expand Down
50 changes: 31 additions & 19 deletions output/remote-desktop/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ else
fi

# Step up Git Credential Manager
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc

# Clone example notebooks (with retries)
RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
if [[ ! -z "${GPG_TTY}" ]]; then
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
fi

# Clone example notebooks (with retries because it sometimes initially fails)
if [[ ! -d ~/aaw-contrib-jupyter-notebooks]]; then
echo "Cloning examples notebooks"

RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
else
echo "Example notebooks already cloned."
fi

if [ ! -e /home/$NB_USER/.Rprofile ]; then
cat /tmp/.Rprofile >> /home/$NB_USER/.Rprofile && rm -rf /tmp/.Rprofile
Expand All @@ -51,11 +59,15 @@ fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
if [ ! -f /home/$NB_USER/.local/bin/rm ]; then
echo "adding rm wrapper"

mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
fi

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"
Expand Down
50 changes: 31 additions & 19 deletions output/rstudio/start-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ else
fi

# Step up Git Credential Manager
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc

# Clone example notebooks (with retries)
RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
if [[ ! -z "${GPG_TTY}" ]]; then
git config --global credential.credentialStore gpg
git config --global credential.helper manager
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
fi

# Clone example notebooks (with retries because it sometimes initially fails)
if [[ ! -d ~/aaw-contrib-jupyter-notebooks]]; then
echo "Cloning examples notebooks"

RETRIES_NO=5
RETRY_DELAY=3
for i in $(seq 1 $RETRIES_NO); do
test -z "$GIT_EXAMPLE_NOTEBOOKS" || git clone "$GIT_EXAMPLE_NOTEBOOKS" && break
echo "Failed to cloned the example notebooks. Attempt $i of $RETRIES_NO"
#if it ran all the retries, exit
[[ $i -eq $RETRIES_NO ]] && echo "Failed to clone example notebooks after $RETRIES_NO retries"
sleep ${RETRY_DELAY}
done
else
echo "Example notebooks already cloned."
fi

if [ ! -e /home/$NB_USER/.Rprofile ]; then
cat /tmp/.Rprofile >> /home/$NB_USER/.Rprofile && rm -rf /tmp/.Rprofile
Expand All @@ -51,11 +59,15 @@ fi

# add rm wrapper:
# https://jirab.statcan.ca/browse/ZPS-40
mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
if [ ! -f /home/$NB_USER/.local/bin/rm ]; then
echo "adding rm wrapper"

mkdir -p /home/$NB_USER/.local/bin/
git clone https://gitlab.k8s.cloud.statcan.ca/zone/build-scripts/snippets/415.git /home/$NB_USER/.local/bin/rm-git
mv /home/$NB_USER/.local/bin/rm-git/rm /home/$NB_USER/.local/bin/rm
rm -rf /home/$NB_USER/.local/bin/rm-git
chmod +x /home/$NB_USER/.local/bin/rm
fi

export VISUAL="/usr/bin/nano"
export EDITOR="$VISUAL"
Expand Down
Loading

0 comments on commit 06467f1

Please sign in to comment.