From 77ed1747ecae25803dd19b3abc9e3a635eeb5ed5 Mon Sep 17 00:00:00 2001 From: Dinindu Senanayake Date: Sun, 4 Aug 2024 16:28:22 +1200 Subject: [PATCH] another attempt at fixing password issue --- submit.yml.erb | 2 +- template/before.sh.erb | 10 ++++------ template/script.sh.erb | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/submit.yml.erb b/submit.yml.erb index 5e83ee3..7ceedab 100644 --- a/submit.yml.erb +++ b/submit.yml.erb @@ -10,7 +10,7 @@ script: native: container: name: "codeserver" - image: "ghcr.io/nesi/training-environment-codeserver-app:v0.1.20" + image: "ghcr.io/nesi/training-environment-codeserver-app:v0.1.21" command: ["/bin/bash","-l","<%= staged_root %>/job_script_content.sh"] restart_policy: 'OnFailure' env: diff --git a/template/before.sh.erb b/template/before.sh.erb index 8dff494..5d390b3 100755 --- a/template/before.sh.erb +++ b/template/before.sh.erb @@ -5,11 +5,11 @@ exec &> >(tee -a "pod.log") # Export the module function if it exists [[ $(type -t module) == "function" ]] && export -f module -source /bin/find_host_port -source /bin/save_passwd_as_secret -export host="$HOST_CFG" -export port="$PORT_CFG" +# Find available port to run server on +export port=$(find_port ${host}) +# Export compute node the script is running on +export host="${host}" echo "host is: ${host}" echo "port is: ${port}" @@ -17,6 +17,4 @@ echo "port is: ${port}" # Generate SHA1 encrypted password (requires OpenSSL installed) #commenting this out to check whether this is the cause of the $PASSWORD variable not getting invoked correctly export password="$(create_passwd 16)" -PASSWORD="$password" -export password PASSWORD diff --git a/template/script.sh.erb b/template/script.sh.erb index c10d74b..dc5ba99 100755 --- a/template/script.sh.erb +++ b/template/script.sh.erb @@ -14,6 +14,8 @@ fi CODE_SERVER_DATAROOT="$HOME/.local/share/code-server" mkdir -p "$CODE_SERVER_DATAROOT/extensions" +# Expose the password to the server. +export PASSWORD="$password" # Print compute node. echo "$(date): Running on compute node ${host}:$port"