diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83a1abe2c9b58053a125f757bfe68de6063e7901..f02b93ba0d5e007635083d0404f835c76e4d7bbb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -239,7 +239,7 @@ jug_xl:nightly: when: never - when: on_success artifacts: - expire_in: 90 days + expire_in: 2 days paths: - build/${BUILD_IMAGE}.sif script: diff --git a/containers/jug/Dockerfile.dev b/containers/jug/Dockerfile.dev index 15083ce7bd5e456dd2956e0a1b1d979efc84d032..f143f2ed30f580b4687f27a2c9712816a3ac5cb3 100644 --- a/containers/jug/Dockerfile.dev +++ b/containers/jug/Dockerfile.dev @@ -131,6 +131,7 @@ RUN cd /opt/spack-environment \ && echo "Grabbing environment info" \ && spack env activate --sh -d . \ | sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ + | sed '/MANPATH/ s/;$/:;/' \ > /etc/profile.d/z10_spack_environment.sh \ && cd /opt/spack-environment \ && echo -n "" \ @@ -140,17 +141,7 @@ RUN cd /opt/spack-environment \ | grep software \ | awk '{print $2}'` \ && echo "export PODIO=${PODIO};" \ - >> /etc/profile.d/z11_jug_env.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 \ + >> /etc/profile.d/z10_spack_environment.sh \ && cd /opt/spack-environment && spack env activate . \ && echo -n "" \ && echo "Installing additional python packages" \ @@ -163,6 +154,7 @@ RUN cd /opt/spack-environment \ && echo "Executing cmake patch for dd4hep 16.1" \ && sed -i "s/FIND_PACKAGE(Python/#&/" /usr/local/cmake/DD4hepBuild.cmake + ## make sure we have the entrypoints setup correctly ENTRYPOINT [] CMD ["bash", "--rcfile", "/etc/profile", "-l"] @@ -193,16 +185,18 @@ RUN find -L /usr/local/* \ ## and links therin for more info 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 \ | sed "s/^/ - /" | sed "s/\* \*\*//" | 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 \ - && chmod +x /usr/local/bin/eic-info + && spack find --no-groups --long --variants | sed "s/^/ - /" >> /etc/jug_info + +COPY eic-shell /usr/local/bin/eic-shell +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 @@ -219,13 +213,10 @@ RUN --mount=from=staging,target=/staging \ rm -rf /usr/local \ && cp -r /staging/opt/software /opt/software \ && cp -r /staging/usr/local /usr/local \ - && cp /staging/etc/profile.d/z11_jug_env.sh \ - /etc/profile.d/z11_jug_env.sh \ - && cat /staging/etc/profile.d/z10_spack_environment.sh \ - | sed '/MANPATH/ s/;$/:;/' \ - > /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 + && cp /staging/etc/profile.d/*.sh /etc/profile.d/ \ + && cp /staging/etc/eic-env.sh /etc/eic-env.sh \ + && cp /staging/etc/jug_info /etc/jug_info \ + && cp -r /staging/.singularity.d /.singularity.d ARG JUG_VERSION=1 RUN echo "" >> /etc/jug_info \ diff --git a/containers/jug/eic-env.sh b/containers/jug/eic-env.sh new file mode 100755 index 0000000000000000000000000000000000000000..77b3ca193010dea78b3e260d80c12d991ae31e57 --- /dev/null +++ b/containers/jug/eic-env.sh @@ -0,0 +1,29 @@ +#!/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 diff --git a/containers/jug/eic-info b/containers/jug/eic-info new file mode 100755 index 0000000000000000000000000000000000000000..135bb4e6d8593bab4dc22a0eaf13e84065318c46 --- /dev/null +++ b/containers/jug/eic-info @@ -0,0 +1,3 @@ +#!/bin/bash + +cat /etc/jug_info diff --git a/containers/jug/eic-shell b/containers/jug/eic-shell index 40f1dfe0260a7f8fc2143e99a2f7b079eec8e169..1a4a7612a300cb7faef6da88e8e41ea75a8274e4 100755 --- a/containers/jug/eic-shell +++ b/containers/jug/eic-shell @@ -1,23 +1,5 @@ #!/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=() if [ -p /dev/stdin ]; then # If we want to read the input line by line @@ -26,12 +8,15 @@ if [ -p /dev/stdin ]; then done fi +## Properly setup environment +source /etc/eic-env.sh + + ### Fire off bash if [ "${#piped_args[@]}" != "0" ]; then - echo "${#piped_args[@]}" - printf "%s\n" "${piped_args[@]}" | bash -s -- --norc + printf "%s\n" "${piped_args[@]}" | bash -s -- --norc --noprofile elif [ $# -gt 0 ]; then - exec bash --norc -c "$@" + exec bash -c "$@" else - exec bash --norc + exec bash --norc --noprofile fi diff --git a/containers/jug/entrypoint.sh b/containers/jug/entrypoint.sh index 589ff3c92e83867c9a4f2c4f6407c5ac671ba3fb..a69c40d97a514040c4e0eeadb697e0e2c36b3360 100755 --- a/containers/jug/entrypoint.sh +++ b/containers/jug/entrypoint.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -source /etc/profile ## Force environment to be clean source /etc/eic-env.sh diff --git a/containers/jug/profile.d/a00_cleanup.sh b/containers/jug/profile.d/a00_cleanup.sh new file mode 100755 index 0000000000000000000000000000000000000000..529ae7269f047f70f44acd57ec2dcfb214d8ac40 --- /dev/null +++ b/containers/jug/profile.d/a00_cleanup.sh @@ -0,0 +1,16 @@ +#!/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 diff --git a/containers/jug/profile.d/z11_jug_env.sh b/containers/jug/profile.d/z11_jug_env.sh new file mode 100755 index 0000000000000000000000000000000000000000..0e2c23b7b0fb58c04a88415e24572634d2dabe1f --- /dev/null +++ b/containers/jug/profile.d/z11_jug_env.sh @@ -0,0 +1,9 @@ +#!/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 diff --git a/containers/jug/singularity.d/env/99-zz_jug_env.sh b/containers/jug/singularity.d/env/99-zz_jug_env.sh new file mode 100755 index 0000000000000000000000000000000000000000..d3d3d3749dff29be19b2b91b87ee45f9676ae1d4 --- /dev/null +++ b/containers/jug/singularity.d/env/99-zz_jug_env.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +source /etc/eic-env.sh diff --git a/spack.yaml b/spack.yaml index 6d623855d90bf8029bcb4759be10d0991523d985..cd808520c144ba6dc3c572fe76861b56af3f8670 100644 --- a/spack.yaml +++ b/spack.yaml @@ -18,6 +18,7 @@ spack: +root7 +tmva +vc +xrootd +ssl ^mesa+opengl -llvm -osmesa - pythia8@8303 +fastjet + - fastjet@3.3.3 - hepmc3@3.2.2 +python +rootio - stow@2.3.1 - cairo@1.16.0 +fc+ft+X+pdf+gobject