diff --git a/instruqt/shared-env-template/01-getting-to-know-the-template/check-cluster b/instruqt/shared-env-template/01-getting-to-know-the-template/check-cluster new file mode 100755 index 000000000..7e0194657 --- /dev/null +++ b/instruqt/shared-env-template/01-getting-to-know-the-template/check-cluster @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# This set line ensures that all failures will cause the script to error and exit +set -euxo pipefail +source /etc/profile/header.sh +export KUBECONFIG=/etc/rancher/k3s/k3s.yaml + +exit 0 diff --git a/instruqt/shared-env-template/01-getting-to-know-the-template/check-shell b/instruqt/shared-env-template/01-getting-to-know-the-template/check-shell index 24bfaa353..09e24c7e3 100755 --- a/instruqt/shared-env-template/01-getting-to-know-the-template/check-shell +++ b/instruqt/shared-env-template/01-getting-to-know-the-template/check-shell @@ -2,6 +2,8 @@ # This set line ensures that all failures will cause the script to error and exit set -euxo pipefail +HOME_DIR=/home/replicant +source /etc/profile/header.sh # save the entire session to check user inputs and outputs tmux capture-pane -t shell -S - diff --git a/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-cluster b/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-cluster new file mode 100755 index 000000000..7e0194657 --- /dev/null +++ b/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-cluster @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# This set line ensures that all failures will cause the script to error and exit +set -euxo pipefail +source /etc/profile/header.sh +export KUBECONFIG=/etc/rancher/k3s/k3s.yaml + +exit 0 diff --git a/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-shell b/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-shell index a64c34234..52a8d3cff 100755 --- a/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-shell +++ b/instruqt/shared-env-template/01-getting-to-know-the-template/cleanup-shell @@ -2,6 +2,8 @@ # This set line ensures that all failures will cause the script to error and exit set -euxo pipefail +HOME_DIR=/home/replicant +source /etc/profile/header.sh # clear the tmux pane and scrollback to look like a fresh shell tmux clear-history -t shell diff --git a/instruqt/shared-env-template/01-getting-to-know-the-template/setup-cluster b/instruqt/shared-env-template/01-getting-to-know-the-template/setup-cluster new file mode 100755 index 000000000..7e0194657 --- /dev/null +++ b/instruqt/shared-env-template/01-getting-to-know-the-template/setup-cluster @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# This set line ensures that all failures will cause the script to error and exit +set -euxo pipefail +source /etc/profile/header.sh +export KUBECONFIG=/etc/rancher/k3s/k3s.yaml + +exit 0 diff --git a/instruqt/shared-env-template/01-getting-to-know-the-template/setup-shell b/instruqt/shared-env-template/01-getting-to-know-the-template/setup-shell index dbb6df308..b38967550 100755 --- a/instruqt/shared-env-template/01-getting-to-know-the-template/setup-shell +++ b/instruqt/shared-env-template/01-getting-to-know-the-template/setup-shell @@ -2,8 +2,19 @@ # This set line ensures that all failures will cause the script to error and exit set -euxo pipefail - HOME_DIR=/home/replicant +source /etc/profile.d/header.sh + +### Assure the tmux session exists +# +# In a test scenario Instuqt does not run the user shell for the +# challenge, which means the tmux session is never established. We +# need to session for the solve scripts for other challenges to +# succeed, so let's create it here. +# +if ! tmux has-session -t shell ; then + tmux new-session -d -s shell su - replicant +fi # Wait for Instruqt bootstrap to be complete while [ ! -f /opt/instruqt/bootstrap/host-bootstrap-completed ] @@ -11,14 +22,3 @@ do echo "Waiting for Instruqt to finish booting the VM" sleep 1 done - -# Display PARTICIPANT_ID info for Vendor Portal -cat<