Skip to content
Snippets Groups Projects
Commit 9353e64b authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Merge branch 'improve_env' into 'master'

Improved environment setup

See merge request !81
parents b0224c7d 2eab0eed
No related branches found
No related tags found
1 merge request!81Improved environment setup
...@@ -239,7 +239,7 @@ jug_xl:nightly: ...@@ -239,7 +239,7 @@ jug_xl:nightly:
when: never when: never
- when: on_success - when: on_success
artifacts: artifacts:
expire_in: 90 days expire_in: 2 days
paths: paths:
- build/${BUILD_IMAGE}.sif - build/${BUILD_IMAGE}.sif
script: script:
......
...@@ -131,6 +131,7 @@ RUN cd /opt/spack-environment \ ...@@ -131,6 +131,7 @@ RUN cd /opt/spack-environment \
&& echo "Grabbing environment info" \ && echo "Grabbing environment info" \
&& spack env activate --sh -d . \ && spack env activate --sh -d . \
| sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ | sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \
| sed '/MANPATH/ s/;$/:;/' \
> /etc/profile.d/z10_spack_environment.sh \ > /etc/profile.d/z10_spack_environment.sh \
&& cd /opt/spack-environment \ && cd /opt/spack-environment \
&& echo -n "" \ && echo -n "" \
...@@ -140,17 +141,7 @@ RUN cd /opt/spack-environment \ ...@@ -140,17 +141,7 @@ RUN cd /opt/spack-environment \
| grep software \ | grep software \
| awk '{print $2}'` \ | awk '{print $2}'` \
&& echo "export PODIO=${PODIO};" \ && echo "export PODIO=${PODIO};" \
>> /etc/profile.d/z11_jug_env.sh \ >> /etc/profile.d/z10_spack_environment.sh \
&& echo "export BINARY_TAG=x86_64-linux-gcc9-opt" \
>> /etc/profile.d/z11_jug_env.sh \
&& echo "if [ ! -z \${ATHENA_PREFIX} ]; then" \
>> /etc/profile.d/z11_jug_env.sh \
&& echo "export LD_LIBRARY_PATH=\$ATHENA_PREFIX/lib:\$LD_LIBRARY_PATH" \
>> /etc/profile.d/z11_jug_env.sh \
&& echo "export PATH=\$ATHENA_PREFIX/bin:\$PATH" \
>> /etc/profile.d/z11_jug_env.sh \
&& echo "fi" \
>> /etc/profile.d/z11_jug_env.sh \
&& cd /opt/spack-environment && spack env activate . \ && cd /opt/spack-environment && spack env activate . \
&& echo -n "" \ && echo -n "" \
&& echo "Installing additional python packages" \ && echo "Installing additional python packages" \
...@@ -163,6 +154,7 @@ RUN cd /opt/spack-environment \ ...@@ -163,6 +154,7 @@ RUN cd /opt/spack-environment \
&& echo "Executing cmake patch for dd4hep 16.1" \ && echo "Executing cmake patch for dd4hep 16.1" \
&& sed -i "s/FIND_PACKAGE(Python/#&/" /usr/local/cmake/DD4hepBuild.cmake && sed -i "s/FIND_PACKAGE(Python/#&/" /usr/local/cmake/DD4hepBuild.cmake
## make sure we have the entrypoints setup correctly ## make sure we have the entrypoints setup correctly
ENTRYPOINT [] ENTRYPOINT []
CMD ["bash", "--rcfile", "/etc/profile", "-l"] CMD ["bash", "--rcfile", "/etc/profile", "-l"]
...@@ -193,16 +185,18 @@ RUN find -L /usr/local/* \ ...@@ -193,16 +185,18 @@ RUN find -L /usr/local/* \
## and links therin for more info ## and links therin for more info
RUN strip --remove-section=.note.ABI-tag /usr/local/lib/libQt5Core.so RUN strip --remove-section=.note.ABI-tag /usr/local/lib/libQt5Core.so
COPY eic-shell /usr/local/bin/eic-shell
COPY entrypoint.sh /usr/local/sbin/entrypoint.sh
RUN spack debug report \ RUN spack debug report \
| sed "s/^/ - /" | sed "s/\* \*\*//" | sed "s/\*\*//" \ | sed "s/^/ - /" | sed "s/\* \*\*//" | sed "s/\*\*//" \
>> /etc/jug_info \ >> /etc/jug_info \
&& spack find --no-groups --long --variants | sed "s/^/ - /" >> /etc/jug_info \ && spack find --no-groups --long --variants | sed "s/^/ - /" >> /etc/jug_info
&& echo "#!/bin/bash" > /usr/local/bin/eic-info \
&& echo "cat /etc/jug_info" >> /usr/local/bin/eic-info \ COPY eic-shell /usr/local/bin/eic-shell
&& chmod +x /usr/local/bin/eic-info COPY eic-info /usr/local/bin/eic-info
COPY entrypoint.sh /usr/local/sbin/entrypoint.sh
COPY eic-env.sh /etc/eic-env.sh
COPY profile.d/a00_cleanup.sh /etc/profile.d
COPY profile.d/z11_jug_env.sh /etc/profile.d
COPY singularity.d /.singularity.d
## ======================================================================================== ## ========================================================================================
## STAGE 3 ## STAGE 3
...@@ -219,13 +213,10 @@ RUN --mount=from=staging,target=/staging \ ...@@ -219,13 +213,10 @@ RUN --mount=from=staging,target=/staging \
rm -rf /usr/local \ rm -rf /usr/local \
&& cp -r /staging/opt/software /opt/software \ && cp -r /staging/opt/software /opt/software \
&& cp -r /staging/usr/local /usr/local \ && cp -r /staging/usr/local /usr/local \
&& cp /staging/etc/profile.d/z11_jug_env.sh \ && cp /staging/etc/profile.d/*.sh /etc/profile.d/ \
/etc/profile.d/z11_jug_env.sh \ && cp /staging/etc/eic-env.sh /etc/eic-env.sh \
&& cat /staging/etc/profile.d/z10_spack_environment.sh \ && cp /staging/etc/jug_info /etc/jug_info \
| sed '/MANPATH/ s/;$/:;/' \ && cp -r /staging/.singularity.d /.singularity.d
> /etc/profile.d/z10_spack_env.sh \
&& cat /etc/profile.d/z1*.sh > /etc/eic-env.sh \
&& cp /staging/etc/jug_info /etc/jug_info
ARG JUG_VERSION=1 ARG JUG_VERSION=1
RUN echo "" >> /etc/jug_info \ RUN echo "" >> /etc/jug_info \
......
#!/bin/bash
for i in /etc/profile.d/*.sh; do
source $i
done
export PS1='eic-shell> \[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33'
export GREP_OPTIONS='--color=auto'
## redefine ls and less as functions, as this is something we
## can import into our plain bash --norc --noprofile session
## (aliases cannot be transferred to a child shell)
function ls {
/bin/ls --color=auto
}
function less {
/usr/bin/less -R
}
MYSHELL=$(ps -p $$ | awk '{print($4);}' | tail -n1)
## only export the functions for bash, as this does not work
## in all shells and we only care about bash here. Note that
## the singularity startup runs in plain sh which requires the
## if statement
if [ "$MYSHELL" == "bash" ]; then
export -f ls
export -f less
fi
unset MYSHELL
#!/bin/bash
cat /etc/jug_info
#!/usr/bin/env bash #!/usr/bin/env bash
## Force environment to be clean
export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/local/lib"
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[ ! -z "$CC" ] && unset CC
[ ! -z "$CXX" ] && unset CXX
[ ! -z "$JUPYTER_CONFIG_DIR" ] && unset JUPYTER_CONFIG_DIR
[ ! -z "$JUPYTER_PATH" ] && unset JUPYTER_PATH
[ ! -z "$CLING_STANDARD_PCH" ] && unset CLING_STANDARD_PCH
[ ! -z "$USER_PATH" ] && unset USER_PATH
[ ! -z "$SHLIB_PATH ] && unset SHLIB_PATH
[ ! -z "$LIBPATH ] && unset $LIBPATH
[ ! -z "$CMAKE_PREFIX_PATH" ] && unset CMAKE_PREFIX_PATH
[ ! -z "$SOFTWARE_HOME" ] && unset SOFTWARE_HOME
[ ! -z "$ROOTSYS" ] && unset ROOTSYS
## Properly setup environment
source /etc/eic-env.sh
piped_args=() piped_args=()
if [ -p /dev/stdin ]; then if [ -p /dev/stdin ]; then
# If we want to read the input line by line # If we want to read the input line by line
...@@ -26,12 +8,15 @@ if [ -p /dev/stdin ]; then ...@@ -26,12 +8,15 @@ if [ -p /dev/stdin ]; then
done done
fi fi
## Properly setup environment
source /etc/eic-env.sh
### Fire off bash ### Fire off bash
if [ "${#piped_args[@]}" != "0" ]; then if [ "${#piped_args[@]}" != "0" ]; then
echo "${#piped_args[@]}" printf "%s\n" "${piped_args[@]}" | bash -s -- --norc --noprofile
printf "%s\n" "${piped_args[@]}" | bash -s -- --norc
elif [ $# -gt 0 ]; then elif [ $# -gt 0 ]; then
exec bash --norc -c "$@" exec bash -c "$@"
else else
exec bash --norc exec bash --norc --noprofile
fi fi
#!/usr/bin/env bash #!/usr/bin/env bash
source /etc/profile
## Force environment to be clean ## Force environment to be clean
source /etc/eic-env.sh source /etc/eic-env.sh
......
#!/bin/bash
## Force environment to be clean
export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/local/lib"
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[ ! -z "$CC" ] && unset CC
[ ! -z "$CXX" ] && unset CXX
[ ! -z "$JUPYTER_CONFIG_DIR" ] && unset JUPYTER_CONFIG_DIR
[ ! -z "$JUPYTER_PATH" ] && unset JUPYTER_PATH
[ ! -z "$CLING_STANDARD_PCH" ] && unset CLING_STANDARD_PCH
[ ! -z "$USER_PATH" ] && unset USER_PATH
[ ! -z "$SHLIB_PATH" ] && unset SHLIB_PATH
[ ! -z "$LIBPATH" ] && unset $LIBPATH
[ ! -z "$CMAKE_PREFIX_PATH" ] && unset CMAKE_PREFIX_PATH
[ ! -z "$SOFTWARE_HOME" ] && unset SOFTWARE_HOME
[ ! -z "$ROOTSYS" ] && unset ROOTSYS
#!/bin/bash
export BINARY_TAG=x86_64-linux-gcc9-opt
if [ ! -z ${ATHENA_PREFIX} ]; then
if [ "$LD_LIBRARY_PATH" != *"${ATHENA_PREFIX}/lib"* ]; then
export LD_LIBRARY_PATH=$ATHENA_PREFIX/lib:$LD_LIBRARY_PATH
export PATH=$ATHENA_PREFIX/bin:$PATH
fi
fi
#!/bin/bash
source /etc/eic-env.sh
...@@ -18,6 +18,7 @@ spack: ...@@ -18,6 +18,7 @@ spack:
+root7 +tmva +vc +xrootd +ssl ^mesa+opengl +root7 +tmva +vc +xrootd +ssl ^mesa+opengl
-llvm -osmesa -llvm -osmesa
- pythia8@8303 +fastjet - pythia8@8303 +fastjet
- fastjet@3.3.3
- hepmc3@3.2.2 +python +rootio - hepmc3@3.2.2 +python +rootio
- stow@2.3.1 - stow@2.3.1
- cairo@1.16.0 +fc+ft+X+pdf+gobject - cairo@1.16.0 +fc+ft+X+pdf+gobject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment