From 8550cb0f5b32133f19cb44e55c70957e0ed006d5 Mon Sep 17 00:00:00 2001
From: "Fabian.Jakub" <fabian@jakub.com>
Date: Wed, 14 Jun 2023 00:27:04 +0200
Subject: [PATCH] add an entry to load general packages from the module system
 at the very beginning of jobs, e.g. to load git

---
 templates/common/build_icon.sh               | 3 +++
 templates/common/build_python_environment.sh | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh
index ce8c799..9892cca 100644
--- a/templates/common/build_icon.sh
+++ b/templates/common/build_icon.sh
@@ -4,6 +4,9 @@ WORKDIR=%HPCROOTDIR%
 ICON_VERSION=%ICON.VERSION%
 COMPILER=%SPACK.COMPILER%
 
+MODULES="%MODULES%"
+if [ ! -z "${MODULES}" ]; then module load $(python -c "print(' '.join(${MODULES}))"); fi
+
 # If the workdir directory does not exist create it
 if [ ! -d ${WORKDIR} ]; then
   mkdir -p ${WORKDIR}
diff --git a/templates/common/build_python_environment.sh b/templates/common/build_python_environment.sh
index e671ea8..6eca487 100644
--- a/templates/common/build_python_environment.sh
+++ b/templates/common/build_python_environment.sh
@@ -7,6 +7,10 @@ SPACK_BRANCH=%SPACK.BRANCH%
 SPACK_COMPILER=%SPACK.COMPILER%
 
 PYTHON_VERSION=%PYTHON_ENVIRONMENT.PYTHON_VERSION%
+
+MODULES="%MODULES%"
+if [ ! -z "${MODULES}" ]; then module load $(python -c "print(' '.join(${MODULES}))"); fi
+
 # Go to the working directory
 cd ${WORKDIR}
 
-- 
GitLab