From 4473aa57a9c6472d17a483588b5dfd0e6ea9f1db Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Thu, 24 Nov 2022 18:51:32 +0000 Subject: [PATCH] feat: allow specifying org/repo for spack and eic-spack --- .gitlab-ci.yml | 12 +++++++++++- containers/jug/dev.Dockerfile | 27 ++++++++++----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c1f77083e..b49504295 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,8 @@ variables: ## note: nightly builds will always use the master/main branch JUGGLER_VERSION: "v9.0.0" + ## Spack organization and repository, e.g. spack/spack + SPACK_ORGREPO: "spack/spack" ## Spack github version, e.g. v0.18.1 or commit hash SPACK_VERSION: "v0.19.0" ## Space-separated list of spack cherry-picks @@ -12,10 +14,14 @@ variables: ## Ref: https://github.com/spack/spack/commit/[hash] ## [hash]: [description] - ## Spack github version, e.g. v0.18 branch, v0.18.1 tag, or commit hash + ## EIC spack organization and repository, e.g. eic/eic-spack + EICSPACK_ORGREPO: "eic/eic-spack" + ## EIC spack github version, e.g. v0.18 branch, v0.18.1 tag, or commit hash EICSPACK_VERSION: "v0.19" ## Space-separated list of eic-spack cherry-picks EICSPACK_CHERRYPICKS: "" + ## Ref: https://github.com/eic/eic-spack/commit/[hash] + ## [hash]: [description] ## We need to enable Docker Buildkit to use cache mounts and better ## build performance overall @@ -240,8 +246,10 @@ jug_dev:default: --target=builder -f containers/jug/dev.Dockerfile --build-arg BASE_IMAGE="${BASE_IMAGE}" + --build-arg SPACK_ORGREPO="${SPACK_ORGREPO}" --build-arg SPACK_VERSION="${SPACK_VERSION}" --build-arg SPACK_CHERRYPICKS="${SPACK_CHERRYPICKS}" + --build-arg EICSPACK_ORGREPO="${EICSPACK_ORGREPO}" --build-arg EICSPACK_VERSION="${EICSPACK_VERSION}" --build-arg EICSPACK_CHERRYPICKS="${EICSPACK_CHERRYPICKS}" --build-arg CACHE_BUST=${PACKAGE_HASH} @@ -252,8 +260,10 @@ jug_dev:default: - docker build -t ${CI_REGISTRY_IMAGE}/${BUILD_IMAGE}:${INTERNAL_TAG} ${CACHE_FLAG} -f containers/jug/dev.Dockerfile --build-arg BASE_IMAGE="${BASE_IMAGE}" + --build-arg SPACK_ORGREPO="${SPACK_ORGREPO}" --build-arg SPACK_VERSION="${SPACK_VERSION}" --build-arg SPACK_CHERRYPICKS="${SPACK_CHERRYPICKS}" + --build-arg EICSPACK_ORGREPO="${EICSPACK_ORGREPO}" --build-arg EICSPACK_VERSION="${EICSPACK_VERSION}" --build-arg EICSPACK_CHERRYPICKS="${EICSPACK_CHERRYPICKS}" --build-arg CACHE_BUST=${PACKAGE_HASH} diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile index 8d3d9a440..b5da3e9b4 100644 --- a/containers/jug/dev.Dockerfile +++ b/containers/jug/dev.Dockerfile @@ -23,25 +23,16 @@ RUN --mount=type=cache,target=/var/cache/apt \ ## Setup spack ## parts: ENV SPACK_ROOT=/opt/spack +ARG SPACK_ORGREPO="spack/spack" ARG SPACK_VERSION="develop" ARG SPACK_CHERRYPICKS="" -ADD https://api.github.com/repos/spack/spack/commits/$SPACK_VERSION /tmp/spack.json +ADD https://api.github.com/repos/${SPACK_ORGREPO}/commits/${SPACK_VERSION} /tmp/spack.json RUN echo "Part 1: regular spack install (as in containerize)" \ - && git clone https://github.com/spack/spack.git /tmp/spack-staging \ - && cd /tmp/spack-staging \ - && git checkout $SPACK_VERSION \ + && git clone https://github.com/${SPACK_ORGREPO}.git ${SPACK_ROOT} \ + && git -C ${SPACK_ROOT} checkout ${SPACK_VERSION} \ && if [ -n "$SPACK_CHERRYPICKS" ] ; then \ - git cherry-pick -n $SPACK_CHERRYPICKS ; \ + git -C ${SPACK_ROOT} cherry-pick -n $SPACK_CHERRYPICKS ; \ fi \ - && cd - \ - && mkdir -p $SPACK_ROOT \ - && cp -r /tmp/spack-staging/bin $SPACK_ROOT/bin \ - && cp -r /tmp/spack-staging/etc $SPACK_ROOT/etc \ - && cp -r /tmp/spack-staging/lib $SPACK_ROOT/lib \ - && cp -r /tmp/spack-staging/share $SPACK_ROOT/share \ - && cp -r /tmp/spack-staging/var $SPACK_ROOT/var \ - && cp -r /tmp/spack-staging/.git $SPACK_ROOT/.git \ - && rm -rf /tmp/spack-staging \ && echo 'export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH'\ >> $SPACK_ROOT/share/setup-env.sh \ && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ @@ -81,10 +72,12 @@ ARG CACHE_BUST="hash" ARG CACHE_NUKE="" ## Setup our custom package overrides -ENV EICSPACK_ROOT=$SPACK_ROOT/var/spack/repos/eic-spack +ENV EICSPACK_ROOT=${SPACK_ROOT}/var/spack/repos/eic-spack +ARG EICSPACK_ORGREPO="eic/eic-spack" ARG EICSPACK_VERSION="$SPACK_VERSION" -ADD https://api.github.com/repos/eic/eic-spack/commits/$EICSPACK_VERSION /tmp/eic-spack.json -RUN git clone https://github.com/eic/eic-spack.git ${EICSPACK_ROOT} \ +ARG EICSPACK_CHERRYPICKS="" +ADD https://api.github.com/repos/${EICSPACK_ORGREPO}/commits/${EICSPACK_VERSION} /tmp/eic-spack.json +RUN git clone https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} \ && git -C ${EICSPACK_ROOT} checkout ${EICSPACK_VERSION} \ && if [ -n "${EICSPACK_CHERRYPICKS}" ] ; then \ git -C ${EICSPACK_ROOT} cherry-pick -n ${EICSPACK_CHERRYPICKS} ; \ -- GitLab