Skip to content

Commit d61aebf

Browse files
authored
Merge branch 'main' into feature-GraphvizHook
2 parents ae17648 + edd0fe4 commit d61aebf

3 files changed

Lines changed: 34 additions & 14 deletions

File tree

.github/workflows/test_eessi_container_script.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- listrepos_default
1919
- listrepos_custom
2020
- no_cvmfs_mounts
21+
- exec
2122
- run
2223
- shell
2324
- container
@@ -74,19 +75,30 @@ jobs:
7475
# test use of --repository None
7576
elif [[ ${{matrix.SCRIPT_TEST}} == 'no_cvmfs_mounts' ]]; then
7677
outfile=out_nocvmfs.txt
77-
./eessi_container.sh --verbose --repository None --mode run mount | tee ${outfile}
78+
./eessi_container.sh --verbose --repository None --mode exec mount | tee ${outfile}
7879
# make sure that there are no CVMFS mounts in the container, i.e. mount does not have any lines line:
7980
# cvmfs2 on /cvmfs/...
8081
! grep "^cvmfs" ${outfile}
8182
82-
# test use of --mode run
83+
# test use of --mode exec
84+
elif [[ ${{matrix.SCRIPT_TEST}} == 'exec' ]]; then
85+
outfile=out_exec.txt
86+
echo "${test_cmd}" > test_script.sh
87+
chmod u+x test_script.sh
88+
export SINGULARITY_BIND="$PWD:/test"
89+
./eessi_container.sh --verbose --mode exec /test/test_script.sh | tee ${outfile}
90+
grep "${out_pattern}" ${outfile}
91+
92+
# test use of --mode run, which should now print a warning
8393
elif [[ ${{matrix.SCRIPT_TEST}} == 'run' ]]; then
8494
outfile=out_run.txt
8595
echo "${test_cmd}" > test_script.sh
8696
chmod u+x test_script.sh
8797
export SINGULARITY_BIND="$PWD:/test"
8898
./eessi_container.sh --verbose --mode run /test/test_script.sh | tee ${outfile}
8999
grep "${out_pattern}" ${outfile}
100+
warn_message="Note: the behaviour of the run mode has changed."
101+
grep "${warn_message}" ${outfile}
90102
91103
# test use of --mode shell
92104
elif [[ ${{matrix.SCRIPT_TEST}} == 'shell' ]]; then
@@ -109,7 +121,7 @@ jobs:
109121
echo "touch /cvmfs/software.eessi.io/${fn}" > test_script.sh
110122
chmod u+x test_script.sh
111123
export SINGULARITY_BIND="$PWD:/test"
112-
./eessi_container.sh --verbose --access rw --mode run /test/test_script.sh > ${outfile}
124+
./eessi_container.sh --verbose --access rw --mode exec /test/test_script.sh > ${outfile}
113125
114126
tmpdir=$(grep "\-\-resume" ${outfile} | sed "s/.*--resume \([^']*\).*/\1/g")
115127
# note: must use '--access rw' again here, since touched file is in overlay upper dir
@@ -152,7 +164,7 @@ jobs:
152164
export SINGULARITY_BIND="$PWD:/test"
153165
echo 'ls -ld /cvmfs*/software.eessi.io/*' > test_script.sh
154166
chmod u+x test_script.sh
155-
./eessi_container.sh --verbose --container ${container} --access rw --overlay-tool unionfs --mode run /test/test_script.sh 2>&1 | tee ${outfile}
167+
./eessi_container.sh --verbose --container ${container} --access rw --overlay-tool unionfs --mode exec /test/test_script.sh 2>&1 | tee ${outfile}
156168
for pattern in "/cvmfs/software.eessi.io/versions" "/cvmfs_ro/software.eessi.io/versions"; do
157169
grep "${pattern}" ${outfile} || (echo "Pattern '${pattern}' not found in ${outfile}"; exit 1)
158170
done

.github/workflows/tests_scripts.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
8686
# run wrapper script + capture & check output
8787
out="${PWD}/eb-${EB_VERSION}.out"
88-
./eessi_container.sh --access rw --mode run --verbose /software-layer-scripts/run_in_compat_layer_env.sh /software-layer-scripts/eb-${EB_VERSION}.sh 2>&1 | tee ${out}
88+
./eessi_container.sh --access rw --mode exec --verbose /software-layer-scripts/run_in_compat_layer_env.sh /software-layer-scripts/eb-${EB_VERSION}.sh 2>&1 | tee ${out}
8989
pattern="^This is EasyBuild ${EB_VERSION} "
9090
grep "${pattern}" ${out} || (echo "Pattern '${pattern}' not found in output!" && exit 1)
9191
done
@@ -103,7 +103,7 @@ jobs:
103103
# make sure that correct EESSI version is used (required because default is a placeholder version)
104104
export EESSI_VERSION_OVERRIDE="${{matrix.EESSI_VERSION}}"
105105
106-
./eessi_container.sh --mode run --verbose /software-layer-scripts/install_software_layer.sh
106+
./eessi_container.sh --mode exec --verbose /software-layer-scripts/install_software_layer.sh
107107
108108
- name: test create_directory_tarballs.sh script
109109
run: |
@@ -116,7 +116,7 @@ jobs:
116116
117117
# scripts need to be copied to /tmp,
118118
# since create_directory_tarballs.sh must be accessible from within build container
119-
./eessi_container.sh --mode run --verbose /software-layer-scripts/create_directory_tarballs.sh "${{matrix.EESSI_VERSION}}"
119+
./eessi_container.sh --mode exec --verbose /software-layer-scripts/create_directory_tarballs.sh "${{matrix.EESSI_VERSION}}"
120120
# check if tarballs have been produced
121121
ls -l *.tar.gz
122122
@@ -140,7 +140,7 @@ jobs:
140140
export EESSI_VERSION_OVERRIDE="${{matrix.EESSI_VERSION}}"
141141
142142
out="${PWD}/test_create_lmodsitepackage.out"
143-
./eessi_container.sh --mode run --verbose /software-layer-scripts/run_in_compat_layer_env.sh /software-layer-scripts/test_lmod_sitepackage.sh 2>&1 | tee ${out}
143+
./eessi_container.sh --mode exec --verbose /software-layer-scripts/run_in_compat_layer_env.sh /software-layer-scripts/test_lmod_sitepackage.sh 2>&1 | tee ${out}
144144
for pattern in "^Site Pkg location.*/software-layer-scripts/.lmod/SitePackage.lua" "LMOD_SITEPACKAGE_LOCATION.*/software-layer-scripts/.lmod/SitePackage.lua"; do
145145
grep "${pattern}" ${out} || (echo "Pattern '${pattern}' not found in output!" && exit 1)
146146
done
@@ -160,6 +160,6 @@ jobs:
160160
export EESSI_VERSION_OVERRIDE="${{matrix.EESSI_VERSION}}"
161161
162162
out="${PWD}/eb-${EB_VERSION}.out"
163-
./eessi_container.sh --repository software.eessi.io,access=rw,mount=bind --mode run --verbose /software-layer-scripts/run_in_compat_layer_env.sh ls 2>&1 | tee ${out}
163+
./eessi_container.sh --repository software.eessi.io,access=rw,mount=bind --mode exec --verbose /software-layer-scripts/run_in_compat_layer_env.sh ls 2>&1 | tee ${out}
164164
echo $(grep "SINGULARITY_BIND" ${out})
165165
grep "SINGULARITY_BIND" ${out} | grep "software.eessi.io" || (echo "software.eessi.io did not seem to be bind mounted!" && exit 1)

eessi_container.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ display_help() {
8686
echo " [default: /..storage../opt-eessi]"
8787
echo " -l | --list-repos - list available repository identifiers [default: false]"
8888
echo " -m | --mode MODE - with MODE==shell (launch interactive shell) or"
89-
echo " MODE==run (run a script or command) [default: shell]"
89+
echo " MODE==exec/run (run a script or command) [default: shell]"
9090
echo " -n | --nvidia MODE - configure the container to work with NVIDIA GPUs,"
9191
echo " MODE==install for a CUDA installation, MODE==run to"
9292
echo " attach a GPU, MODE==all for both [default: false]"
@@ -119,7 +119,7 @@ display_help() {
119119
echo " -y | --https-proxy URL - provides URL for the env variable https_proxy"
120120
echo " [default: not set]; uses env var \$https_proxy if set"
121121
echo
122-
echo " If value for --mode is 'run', the SCRIPT/COMMAND provided is executed. If"
122+
echo " If value for --mode is 'exec' or 'run', the SCRIPT/COMMAND provided is executed. If"
123123
echo " arguments to the script/command start with '-' or '--', use the flag terminator"
124124
echo " '--' to let eessi_container.sh stop parsing arguments."
125125
}
@@ -377,10 +377,18 @@ fi
377377
# HOST_STORAGE_ERROR_EXITCODE
378378

379379
# (arg -m|--mode) check if MODE is known
380-
if [[ "${MODE}" != "shell" && "${MODE}" != "run" ]]; then
380+
if [[ "${MODE}" != "shell" && "${MODE}" != "exec" && "${MODE}" != "run" ]]; then
381381
fatal_error "unknown execution mode '${MODE}'" "${MODE_UNKNOWN_EXITCODE}"
382382
fi
383383

384+
# the run mode should actually call "apptainer exec", so simply override run to exec
385+
if [[ "${MODE}" == "run" ]]; then
386+
echo_yellow "Note: the behaviour of the run mode has changed."
387+
echo_yellow "Previously, it mistakenly ran 'apptainer/singularity run', but it now runs 'apptainer/singularity exec' instead."
388+
echo_yellow "You can silence this message by using --mode exec instead of --mode run."
389+
MODE="exec"
390+
fi
391+
384392
# Also validate the NVIDIA GPU mode (if present)
385393
if [[ ${SETUP_NVIDIA} -eq 1 ]]; then
386394
if [[ "${NVIDIA_MODE}" != "run" && "${NVIDIA_MODE}" != "install" && "${NVIDIA_MODE}" != "all" ]]; then
@@ -443,8 +451,8 @@ done
443451
# TODO (arg -y|--https-proxy) check if https proxy is accessible
444452
# HTTPS_PROXY_ERROR_EXITCODE
445453

446-
# check if a script is provided if mode is 'run'
447-
if [[ "${MODE}" == "run" ]]; then
454+
# check if a script is provided if mode is 'exec'
455+
if [[ "${MODE}" == "exec" ]]; then
448456
if [[ $# -eq 0 ]]; then
449457
fatal_error "no command specified to run?!" "${RUN_SCRIPT_MISSING_EXITCODE}"
450458
fi

0 commit comments

Comments
 (0)