diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a2caec6..696b6d42 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -343,6 +343,36 @@ base: let attempts=$attempts+1 ; done +base:noargs: + extends: .build + stage: base + needs: + - version + script: + - attempts=0 + - nocache="" + - while ! + docker buildx build ${BUILD_OPTIONS} ${nocache} + --cache-from type=registry,ref=${CI_REGISTRY}/${CI_PROJECT_PATH}/buildcache:base-noargs-${CI_COMMIT_REF_SLUG}-amd64 + --cache-from type=registry,ref=${GH_REGISTRY}/${GH_REGISTRY_USER}/buildcache:base-noargs-${CI_COMMIT_REF_SLUG}-amd64 + --cache-from type=registry,ref=${CI_REGISTRY}/${CI_PROJECT_PATH}/buildcache:base-noargs-${CI_DEFAULT_BRANCH_SLUG}-amd64 + --cache-from type=registry,ref=${GH_REGISTRY}/${GH_REGISTRY_USER}/buildcache:base-noargs-${CI_DEFAULT_BRANCH_SLUG}-amd64 + --cache-to type=registry,ref=${CI_REGISTRY}/${CI_PROJECT_PATH}/buildcache:base-noargs-${CI_COMMIT_REF_SLUG}-amd64,mode=max + --file containers/debian/Dockerfile + containers/debian + 2>&1 | tee build.log + ; do + if grep "unknown blob" build.log ; then + nocache="--no-cache" ; + else + exit 1 ; + fi ; + if test ${attempts} -ge 1 ; then + echo "Failed to build on second attempt!" ; + exit 1 ; + fi ; + let attempts=$attempts+1 ; + done eic: parallel: @@ -496,6 +526,39 @@ eic: let attempts=$attempts+1 ; done +eic:noargs: + extends: .build + stage: eic + needs: + - version + - base + script: + - attempts=0 + - nocache="" + - while ! + docker buildx build ${BUILD_OPTIONS} ${nocache} + --cache-from type=registry,ref=${CI_REGISTRY}/${CI_PROJECT_PATH}/buildcache:eic-noargs-${CI_COMMIT_REF_SLUG}-amd64 + --cache-from type=registry,ref=${GH_REGISTRY}/${GH_REGISTRY_USER}/buildcache:eic-noargs--${CI_COMMIT_REF_SLUG}-amd64 + --cache-from type=registry,ref=${CI_REGISTRY}/${CI_PROJECT_PATH}/buildcache:eic-noargs--${CI_DEFAULT_BRANCH_SLUG}-amd64 + --cache-from type=registry,ref=${GH_REGISTRY}/${GH_REGISTRY_USER}/buildcache:eic-noargs--${CI_DEFAULT_BRANCH_SLUG}-amd64 + --cache-to type=registry,ref=${CI_REGISTRY}/${CI_PROJECT_PATH}/buildcache:eic-noargs--${CI_COMMIT_REF_SLUG}-amd64,mode=max + --build-context spack-environment=spack-environment + --file containers/eic/Dockerfile + containers/eic + 2>&1 | tee build.log + ; do + if grep "unknown blob" build.log ; then + nocache="--no-cache" ; + else + exit 1 ; + fi ; + if test ${attempts} -ge 1 ; then + echo "Failed to build on second attempt!" ; + exit 1 ; + fi ; + let attempts=$attempts+1 ; + done + user_spack_environment: stage: benchmarks needs: diff --git a/containers/debian/Dockerfile b/containers/debian/Dockerfile index ee4583ee..af9398af 100644 --- a/containers/debian/Dockerfile +++ b/containers/debian/Dockerfile @@ -237,6 +237,7 @@ target=${target[${TARGETPLATFORM}]} spack config --scope site add "packages:all:require:[target=${target}]" spack config --scope site add "packages:all:target:[${target}]" spack config blame packages +mkdir -p $HOME/.spack/ spack config --scope user add "config:suppress_gpg_warnings:true" spack config --scope user add "config:build_jobs:${jobs}" spack config --scope user add "config:db_lock_timeout:${jobs}00" @@ -278,4 +279,4 @@ set -e git clone --filter=tree:0 https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} git -C ${EICSPACK_ROOT} checkout ${EICSPACK_VERSION} spack repo add --scope site "${EICSPACK_ROOT}" -EOF \ No newline at end of file +EOF diff --git a/containers/debian/README.md b/containers/debian/README.md index 46aaf43b..34bf9cbb 100644 --- a/containers/debian/README.md +++ b/containers/debian/README.md @@ -3,3 +3,13 @@ To build the container in this directory: ``` docker buildx build -f Dockerfile . ``` + +**Note:** The minimal build command shown above will assume default values for all build arguments. For this container, that means 'develop' versions for all spack repositories: +- `SPACK_VERSION=develop` +- `SPACKPACKAGES_VERSION=develop` +- `KEY4HEPSPACK_VERSION=main` +- `EICSPACK_VERSION=develop` + +**Important:** Docker layer caching will not automatically update the previous checkout of these 'develop' versions. To ensure you have the latest commits, you may need to use `--no-cache` or rebuild without cache. + +For specific operations as used in CI builds (including custom build arguments and cache management), please refer to the GitHub and GitLab CI workflows in this repository. diff --git a/containers/eic/Dockerfile b/containers/eic/Dockerfile index 4e0c5422..b6869259 100644 --- a/containers/eic/Dockerfile +++ b/containers/eic/Dockerfile @@ -41,6 +41,8 @@ ARG TARGETPLATFORM LABEL org.opencontainers.image.title="Electron-Ion Collider build concretization image (default configuration, $TARGETPLATFORM)" ## Copy our default environment +## Note that a named build context is *required* for this build: +## e.g. --build-context spack-environment=../../spack-environment COPY --from=spack-environment . /opt/spack-environment/ ARG ENV=xl ENV SPACK_ENV=/opt/spack-environment/${ENV} @@ -114,6 +116,8 @@ ARG TARGETPLATFORM LABEL org.opencontainers.image.title="Electron-Ion Collider runtime concretization image (default configuration, $TARGETPLATFORM)" ## Copy our default environment +## Note that a named build context is *required* for this build: +## e.g. --build-context spack-environment=../../spack-environment COPY --from=spack-environment . /opt/spack-environment/ ARG ENV=xl ENV SPACK_ENV=/opt/spack-environment/${ENV} diff --git a/containers/eic/README.md b/containers/eic/README.md index 859d7466..30c4f0d2 100644 --- a/containers/eic/README.md +++ b/containers/eic/README.md @@ -3,3 +3,16 @@ To build the container in this directory: ``` docker buildx build -f Dockerfile --build-context spack-environment=../../spack-environment . ``` + +**Note:** The minimal build command shown above will assume default values for all build arguments. For this container, that means 'develop' versions for all spack repositories: +- `BUILDER_IMAGE=debian_stable_base` +- `RUNTIME_IMAGE=debian_stable_base` +- `ENV=xl` +- `BENCHMARK_COM_VERSION=master` +- `BENCHMARK_DET_VERSION=master` +- `BENCHMARK_REC_VERSION=master` +- `BENCHMARK_PHY_VERSION=master` + +**Important:** Docker layer caching will not automatically update the previous checkout of these 'master' versions. To ensure you have the latest commits, you may need to use `--no-cache` or rebuild without cache. + +For specific operations as used in CI builds (including custom build arguments and cache management), please refer to the GitHub and GitLab CI workflows in this repository.