diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f38d409bc087c332159ccb07d030164556f51840..83a1abe2c9b58053a125f757bfe68de6063e7901 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,7 @@ stages: - build:dev ## naked dev container image - build:release ## dressed release container image - deploy ## build/deploy singularity images + - test - finalize default: @@ -96,7 +97,7 @@ version: NIGHTLY_TAG=${NIGHTLY} if [ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event" ]; then INTERNAL_TAG="unstable-mr-${CI_MERGE_REQUEST_ID}" - NIGHTLY_TAG= + NIGHTLY_TAG="${INTERNAL_TAG}-nightly" EXPORT_TAG=$UNSTABLE EXPORT_TAG2= elif [ "$CI_COMMIT_TAG" = "v${VERSION}" ]; then @@ -208,6 +209,8 @@ jug_xl:nightly: rules: - if: '$CI_COMMIT_BRANCH == "master"' when: on_success + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: on_success - when: never needs: - version @@ -220,9 +223,14 @@ jug_xl:nightly: --build-arg INTERNAL_TAG=${INTERNAL_TAG} --build-arg JUG_VERSION=nightly-$(date +%Y-%m-%d_%H-%M-%S)-$(git rev-parse HEAD) containers/jug + - | + PUSH_FLAG="" + if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then + PUSH_FLAG="--eicweb" + fi - ./gitlab-ci/docker_push.sh -i ${BUILD_IMAGE} -l ${NIGHTLY_TAG} -n $DOCKER_NTRIES -t $DOCKER_WAIT_TIME - ${NIGHTLY_TAG} + ${NIGHTLY_TAG} ${PUSH_FLAG} .singularity: stage: deploy @@ -262,6 +270,8 @@ jug_xl:singularity:nightly: rules: - if: '$CI_COMMIT_BRANCH == "master"' when: on_success + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: on_success - when: never artifacts: expire_in: 1 days @@ -289,6 +299,9 @@ juggler:master: project: EIC/juggler allow_failure: true +include: + - local: 'tests/tutorial/config.yml' + cleanup: stage: finalize dependencies: @@ -299,3 +312,7 @@ cleanup: - ./gitlab-ci/cleanup_registry.sh -i debian_base -r 66 ${INTERNAL_TAG} - ./gitlab-ci/cleanup_registry.sh -i jug_dev -r 68 ${INTERNAL_TAG} - ./gitlab-ci/cleanup_registry.sh -i jug_xl -r 69 ${INTERNAL_TAG} + - | + if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then + ./gitlab-ci/cleanup_registry.sh -i jug_xl -r 69 ${NIGHTLY_TAG} + fi diff --git a/containers/jug/Dockerfile.dev b/containers/jug/Dockerfile.dev index e65606ac492f0fec114e6b0575c461fb7136d88a..1a6f6d320057b37c7c4580e96f53f713d8f6f73e 100644 --- a/containers/jug/Dockerfile.dev +++ b/containers/jug/Dockerfile.dev @@ -130,9 +130,8 @@ RUN cd /opt/spack-environment \ && echo -n "" \ && echo "Grabbing environment info" \ && spack env activate --sh -d . \ - > /etc/profile.d/z10_spack_environment.sh \ - && sed -i "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ - /etc/profile.d/z10_spack_environment.sh \ + | sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ + > /etc/profile.d/z10_spack_environment.sh \ && cd /opt/spack-environment \ && echo -n "" \ && echo "Add extra environment variables for Jug, Podio and Gaudi" \ @@ -220,12 +219,12 @@ 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/z10_spack_environment.sh /etc/eic-env.sh \ - && sed -i '/MANPATH/ s/;$/:;/' /etc/eic-env.sh \ && cp /staging/etc/profile.d/z11_jug_env.sh \ /etc/profile.d/z11_jug_env.sh \ - && cat /etc/profile.d/z11_jug_env.sh >> /etc/eic-env.sh \ - && cp /etc/eic-env.sh /etc/profile.d/z10_eic-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 ARG JUG_VERSION=1 diff --git a/containers/jug/eic-shell b/containers/jug/eic-shell index 2627cab7f89539bd9d398d6922312153441a9a9d..40f1dfe0260a7f8fc2143e99a2f7b079eec8e169 100755 --- a/containers/jug/eic-shell +++ b/containers/jug/eic-shell @@ -1,7 +1,21 @@ #!/usr/bin/env bash -source /etc/profile ## 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=() @@ -15,9 +29,9 @@ fi ### Fire off bash if [ "${#piped_args[@]}" != "0" ]; then echo "${#piped_args[@]}" - printf "%s\n" "${piped_args[@]}" | bash + printf "%s\n" "${piped_args[@]}" | bash -s -- --norc elif [ $# -gt 0 ]; then - exec bash -c "$@" + exec bash --norc -c "$@" else - exec bash + exec bash --norc fi diff --git a/install.sh b/install.sh index b39a1010aef21b43ffcb6a7949b74a6ccc6397cc..87ae8199ac6eb7aeb2811d379c4c85755ef08d09 100755 --- a/install.sh +++ b/install.sh @@ -124,6 +124,9 @@ else ln -sf /cvmfs/eic.opensciencegrid.org/singularity/athena/${CONTAINER}_v${VERSION}.sif ${SIF} elif [ -f /gpfs02/cvmfst0/eic.opensciencegrid.org/singularity/athena/${CONTAINER}_v${VERSION}.sif ]; then ln -sf /gpfs02/cvmfst0/eic.opensciencegrid.org/singularity/athena/${CONTAINER}_v${VERSION}.sif ${SIF} + ## check if we have an internal CI image we will use for testing purposes + elif [ -f $PWD/.gitlab-ci/${CONTAINER}-${VERSION}.sif ]; then + ln -sf $PWD/.gitlab-ci/${CONTAINER}-${VERSION}.sif ${SIF} ## if not, download the container to the system else ## get the python installer and run the old-style install diff --git a/tests/tutorial/config.yml b/tests/tutorial/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..e66aa7d653c7b4848d8103df8b4dc99de98698fd --- /dev/null +++ b/tests/tutorial/config.yml @@ -0,0 +1,28 @@ +## Ensure the container still works for the new container +## even with a strange environment setup + + +test:tutorial: + stage: test + needs: + - version + - jug_xl:singularity:nightly + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + when: on_success + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: on_success + - when: never + script: + - mkdir eic && cd eic + - mkdir -p .gitlab-ci && mv ../build/jug_xl.sif .gitlab-ci/jug_xl-ci-test.sif + # setup our environment to be weird + - | + echo ROOTSYS=/invalid-path >> ~/.bashrc + echo CC=`which gfortran` >> ~/.bashrc + echo CXX=`which gfortran` >> ~/.bashrc + # setup tutorial starting position + - bash ../install.sh -v ci-test + # now attempt the tutorial + - ./eic-shell tests/tutorial/quick-start.sh + - ./eic-shell tests/tutorial/part1.sh diff --git a/tests/tutorial/part1.sh b/tests/tutorial/part1.sh new file mode 100644 index 0000000000000000000000000000000000000000..64d63b5ca0f8718081eaf49d76068f1617f5caf2 --- /dev/null +++ b/tests/tutorial/part1.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +source /opt/detector/setup.sh + +git clone https://eicweb.phy.anl.gov/EIC/tutorials/ip6_tutorial_1.git part1 +pushd part1 +cmake -B build -S . -DCMAKE_INSTALL_PREFIX=$ATHENA_PREFIX -DCMAKE_CXX_STANDARD=17 +cmake --build build -j4 -- install +dd_web_display --export gem_tracker.xml +checkOverlaps -t 0.0001 -c gem_tracker.xml +npdet_info dump gem_tracker.xml +npsim --runType run --enableG4GPS \ + --macroFile gps.mac \ + --compactFile ./gem_tracker.xml \ + --outputFile gem_tracker_sim.root + +root -b -q scripts/tutorial1_hit_position.cxx+ +root -b -q scripts/tutorial2_cell_size.cxx+ +popd diff --git a/tests/tutorial/quick-start.sh b/tests/tutorial/quick-start.sh new file mode 100644 index 0000000000000000000000000000000000000000..6007a98f2fd20c71a255fa5870f108cd6a7a7d0c --- /dev/null +++ b/tests/tutorial/quick-start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +git clone https://eicweb.phy.anl.gov/EIC/detectors/athena.git +git clone https://eicweb.phy.anl.gov/EIC/detectors/ip6.git +ln -s ../ip6/ip6 athena/ip6 + +echo "PART 1: QUICK START" +pushd athena +source /opt/detector/setup.sh +dd_web_display --export athena.xml +popd