From 73a23d6b204c7f8777c496e40a61694e45c53c47 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Wed, 1 Nov 2023 20:57:50 +0000 Subject: [PATCH] feat: install most dependencies in cachable layer, before adding main --- .gitlab-ci.yml | 8 ++++++-- containers/jug/dev.Dockerfile | 32 +++++++++++++++++++++++++------ spack-environment/dev/spack.yaml | 2 ++ spack-environment/packages.yaml | 6 ++++++ spack-environment/prod/spack.yaml | 2 ++ 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab717018b..41277a21a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -337,8 +337,12 @@ jug_dev: --build-arg S3_SECRET_KEY=${S3_SECRET_KEY} --build-arg JUG_VERSION=${EXPORT_TAG}-${BUILD_TYPE}-$(git rev-parse HEAD) ${IF_BUILD_DEFAULT:+ - --build-arg JUGGLER_VERSION=${JUGGLER_VERSION} - --build-arg EICRECON_VERSION=${EICRECON_VERSION} + ${JUGGLER_VERSION:+--build-arg JUGGLER_VERSION=${JUGGLER_VERSION}} + ${EICRECON_VERSION:+--build-arg EICRECON_VERSION=${EICRECON_VERSION}} + } + ${IF_BUILD_NIGHTLY:+ + --build-arg JUGGLER_VERSION=main + --build-arg EICRECON_VERSION=main } --build-arg ENV=${ENV} --build-arg jobs=${JOBS} diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile index 5306d30a5..2b38d42df 100644 --- a/containers/jug/dev.Dockerfile +++ b/containers/jug/dev.Dockerfile @@ -132,10 +132,6 @@ FROM spack as builder ## Setup our custom environment (secret mount for write-enabled mirror) COPY --from=spack-environment . /opt/spack-environment/ ARG ENV=dev -ARG JUGGLER_VERSION="main" -ADD https://eicweb.phy.anl.gov/api/v4/projects/EIC%2Fjuggler/repository/tree?ref=${JUGGLER_VERSION} /tmp/juggler.json -ARG EICRECON_VERSION="main" -ADD https://api.github.com/repos/eic/eicrecon/commits/${EICRECON_VERSION} /tmp/eicrecon.json ENV SPACK_ENV=/opt/spack-environment/${ENV} RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \ --mount=type=cache,target=/var/cache/spack \ @@ -146,8 +142,32 @@ export CCACHE_DIR=/ccache spack buildcache update-index local spack buildcache update-index eics3rw spack env activate --dir ${SPACK_ENV} -spack add juggler@git.${JUGGLER_VERSION} -spack add eicrecon@git.${EICRECON_VERSION} +spack concretize --fresh --force --quiet +make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw" +ccache --show-stats +ccache --zero-stats +EOF + +## Setup our custom environment with custom versions (on top of cached layer) +ARG JUGGLER_VERSION="" +ARG EICRECON_VERSION="" +ADD https://eicweb.phy.anl.gov/api/v4/projects/EIC%2Fjuggler/repository/tree?ref=${JUGGLER_VERSION} /tmp/juggler.json +ADD https://api.github.com/repos/eic/eicrecon/commits/${EICRECON_VERSION} /tmp/eicrecon.json +RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \ + --mount=type=cache,target=/var/cache/spack \ + --mount=type=secret,id=mirrors,target=/opt/spack/etc/spack/mirrors.yaml \ + <<EOF +source $SPACK_ROOT/share/spack/setup-env.sh +export CCACHE_DIR=/ccache +spack buildcache update-index local +spack buildcache update-index eics3rw +spack env activate --dir ${SPACK_ENV} +if [ -n ${JUGGLER_VERSION} ] ; then + spack rm juggler && spack add juggler@git.${JUGGLER_VERSION} +fi +if [ -n ${EICRECON_VERSION} ] ; then + spack rm eicrecon && spack add eicrecon@git.${EICRECON_VERSION} +fi spack concretize --fresh --force --quiet make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw" ccache --show-stats diff --git a/spack-environment/dev/spack.yaml b/spack-environment/dev/spack.yaml index 59148553f..cb97c1b06 100644 --- a/spack-environment/dev/spack.yaml +++ b/spack-environment/dev/spack.yaml @@ -22,6 +22,7 @@ spack: - edm4eic - edm4hep - eic-smear + - eicrecon - eigen - emacs - fastjet @@ -36,6 +37,7 @@ spack: - imagemagick - irt - jana2 + - juggler - lcov - lhapdf - madx diff --git a/spack-environment/packages.yaml b/spack-environment/packages.yaml index 152f83d06..6cb7cba8b 100644 --- a/spack-environment/packages.yaml +++ b/spack-environment/packages.yaml @@ -89,6 +89,9 @@ packages: eic-smear: require: - '@1.1.12' + eicrecon: + require: + - '@1.6.1' eigen: require: - '@3.4.0' @@ -146,6 +149,9 @@ packages: require: - '@2.1.1' - -ipo +podio +root +zmq + juggler: + require: + - '@10.1.0' lcov: require: - '@1.16' diff --git a/spack-environment/prod/spack.yaml b/spack-environment/prod/spack.yaml index 9e09d2033..a22acf45e 100644 --- a/spack-environment/prod/spack.yaml +++ b/spack-environment/prod/spack.yaml @@ -7,6 +7,7 @@ spack: - cmake - dd4hep -ddeve - edm4eic + - eicrecon - fastjet - fjcontrib - gaudi @@ -15,6 +16,7 @@ spack: - intel-tbb - irt - jana2 + - juggler - npsim -geocad - py-boto3 - py-jinja2 -- GitLab