Skip to content

Commit f0ad86b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into adjustments-for-eessi-bot
Merge updates to build_container.sh
2 parents 8fa8569 + 677e04c commit f0ad86b

File tree

5 files changed

+83
-41
lines changed

5 files changed

+83
-41
lines changed

.github/workflows/tests_scripts.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- build_container.sh
77
- install_software_layer.sh
88
- run_in_compat_layer_env.sh
9+
- utils.sh
10+
- update_lmod_cache.sh
911

1012
pull_request:
1113
branches:
@@ -14,6 +16,8 @@ on:
1416
- build_container.sh
1517
- install_software_layer.sh
1618
- run_in_compat_layer_env.sh
19+
- utils.sh
20+
- update_lmod_cache.sh
1721
jobs:
1822
build:
1923
runs-on: ubuntu-20.04
@@ -25,8 +29,9 @@ jobs:
2529
run: |
2630
sudo apt-get install alien
2731
alien --version
28-
curl -OL https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/singularity-3.8.5-2.el8.x86_64.rpm
29-
sudo alien -d singularity-3.8.5-2.el8.x86_64.rpm
32+
singularity_rpm=$(curl --silent -L https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/ | grep singularity | sed 's/.*\(singularity[0-9._a-z-]*.rpm\).*/\1/g')
33+
curl -OL https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/$singularity_rpm
34+
sudo alien -d $singularity_rpm
3035
sudo apt install ./singularity*.deb
3136
singularity --version
3237

EESSI-pilot-install-software.sh

+2-38
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,7 @@
55

66
TOPDIR=$(dirname $(realpath $0))
77

8-
function echo_green() {
9-
echo -e "\e[32m$1\e[0m"
10-
}
11-
12-
function echo_red() {
13-
echo -e "\e[31m$1\e[0m"
14-
}
15-
16-
function echo_yellow() {
17-
echo -e "\e[33m$1\e[0m"
18-
}
19-
20-
function fatal_error() {
21-
echo_red "ERROR: $1" >&2
22-
exit 1
23-
}
24-
25-
function check_exit_code {
26-
ec=$1
27-
ok_msg=$2
28-
fail_msg=$3
29-
30-
if [[ $ec -eq 0 ]]; then
31-
echo_green "${ok_msg}"
32-
else
33-
fatal_error "${fail_msg}"
34-
fi
35-
}
8+
source $TOPDIR/utils.sh
369

3710
# honor $TMPDIR if it is already defined, use /tmp otherwise
3811
if [ -z $TMPDIR ]; then
@@ -339,16 +312,7 @@ if [ ! -f $LMOD_RC ]; then
339312
check_exit_code $? "$LMOD_RC created" "Failed to create $LMOD_RC"
340313
fi
341314

342-
# we need to specify the path to the Lmod cache dir + timestamp file to ensure
343-
# that update_lmod_system_cache_files updates correct Lmod cache
344-
lmod_cache_dir=${EASYBUILD_INSTALLPATH}/.lmod/cache
345-
lmod_cache_timestamp_file=${EASYBUILD_INSTALLPATH}/.lmod/cache/timestamp
346-
modpath=${EASYBUILD_INSTALLPATH}/modules/all
347-
348-
${LMOD_DIR}/update_lmod_system_cache_files -d ${lmod_cache_dir} -t ${lmod_cache_timestamp_file} ${modpath}
349-
check_exit_code $? "Lmod cache updated" "Lmod cache update failed!"
350-
351-
ls -lrt ${EASYBUILD_INSTALLPATH}/.lmod/cache
315+
$TOPDIR/update_lmod_cache.sh ${EPREFIX} ${EASYBUILD_INSTALLPATH}
352316

353317
echo ">> Checking for missing installations..."
354318
ok_msg="No missing installations, party time!"

build_container.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ mkdir -p $EESSI_TMPDIR/{home,overlay-upper,overlay-work}
4141
mkdir -p $EESSI_TMPDIR/{var-lib-cvmfs,var-run-cvmfs}
4242
# configure Singularity
4343
export SINGULARITY_CACHEDIR=$EESSI_TMPDIR/singularity_cache
44-
export SINGULARITY_BIND="$EESSI_TMPDIR/var-run-cvmfs:/var/run/cvmfs,$EESSI_TMPDIR/var-lib-cvmfs:/var/lib/cvmfs,$EESSI_TMPDIR"
44+
45+
# take into account that $SINGULARITY_BIND may be defined already, to bind additional paths into the build container
46+
BIND_PATHS="$EESSI_TMPDIR/var-run-cvmfs:/var/run/cvmfs,$EESSI_TMPDIR/var-lib-cvmfs:/var/lib/cvmfs,$EESSI_TMPDIR"
47+
if [ -z $SINGULARITY_BIND ]; then
48+
export SINGULARITY_BIND="$BIND_PATHS"
49+
else
50+
export SINGULARITY_BIND="$SINGULARITY_BIND,$BIND_PATHS"
51+
fi
52+
4553
export SINGULARITY_HOME="$EESSI_TMPDIR/home:/home/$USER"
4654

4755
# set environment variables for fuse mounts in Singularity container

update_lmod_cache.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
#
3+
# Script to update Lmod cache in EESSI
4+
#
5+
6+
TOPDIR=$(dirname $(realpath $0))
7+
8+
source $TOPDIR/utils.sh
9+
10+
if [ $# -ne 2 ]; then
11+
echo "Usage: $0 <path to compat layer directory> <path to software installation prefix>" >&2
12+
exit 1
13+
fi
14+
EPREFIX=$1
15+
EASYBUILD_INSTALLPATH=$2
16+
17+
if [ ! -d $EPREFIX ]; then
18+
echo "\$EPREFIX does not exist!" >&2
19+
exit 2
20+
fi
21+
if [ ! -d $EASYBUILD_INSTALLPATH ]; then
22+
echo "\$EASYBUILD_INSTALLPATH does not exist!" >&2
23+
exit 2
24+
fi
25+
26+
source $EPREFIX/usr/share/Lmod/init/bash
27+
28+
# we need to specify the path to the Lmod cache dir + timestamp file to ensure
29+
# that update_lmod_system_cache_files updates correct Lmod cache
30+
lmod_cache_dir=${EASYBUILD_INSTALLPATH}/.lmod/cache
31+
lmod_cache_timestamp_file=${EASYBUILD_INSTALLPATH}/.lmod/cache/timestamp
32+
modpath=${EASYBUILD_INSTALLPATH}/modules/all
33+
34+
${LMOD_DIR}/update_lmod_system_cache_files -d ${lmod_cache_dir} -t ${lmod_cache_timestamp_file} ${modpath}
35+
check_exit_code $? "Lmod cache updated" "Lmod cache update failed!"
36+
37+
ls -lrt ${EASYBUILD_INSTALLPATH}/.lmod/cache

utils.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
function echo_green() {
2+
echo -e "\e[32m$1\e[0m"
3+
}
4+
5+
function echo_red() {
6+
echo -e "\e[31m$1\e[0m"
7+
}
8+
9+
function echo_yellow() {
10+
echo -e "\e[33m$1\e[0m"
11+
}
12+
13+
function fatal_error() {
14+
echo_red "ERROR: $1" >&2
15+
exit 1
16+
}
17+
18+
function check_exit_code {
19+
ec=$1
20+
ok_msg=$2
21+
fail_msg=$3
22+
23+
if [[ $ec -eq 0 ]]; then
24+
echo_green "${ok_msg}"
25+
else
26+
fatal_error "${fail_msg}"
27+
fi
28+
}

0 commit comments

Comments
 (0)