Skip to content
Snippets Groups Projects
Commit ccc0e228 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

feat: use oci build cache on eicweb and ghcr

parent aeac427e
No related branches found
No related tags found
1 merge request!792feat: use oci build cache on eicweb and ghcr
...@@ -70,14 +70,6 @@ spack compiler find --scope site ...@@ -70,14 +70,6 @@ spack compiler find --scope site
spack config blame compilers spack config blame compilers
EOF EOF
## Setup local buildcache mirrors
RUN --mount=type=cache,target=/var/cache/spack <<EOF
set -e
spack mirror add local /var/cache/spack/mirror/${SPACK_VERSION}
spack buildcache update-index local
spack mirror list
EOF
## Setup eics3 buildcache mirrors ## Setup eics3 buildcache mirrors
## - this always adds the read-only mirror to the container ## - this always adds the read-only mirror to the container
## - the write-enabled mirror is provided later as a secret mount ## - the write-enabled mirror is provided later as a secret mount
...@@ -144,13 +136,13 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \ ...@@ -144,13 +136,13 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
<<EOF <<EOF
set -e set -e
export CCACHE_DIR=/ccache export CCACHE_DIR=/ccache
spack buildcache update-index local find /var/cache/spack/blobs/sha256/ -atime +7 -delete
spack buildcache update-index eics3rw spack buildcache update-index eics3rw
spack env activate --dir ${SPACK_ENV} spack env activate --dir ${SPACK_ENV}
spack add juggler@git.${JUGGLER_VERSION} spack add juggler@git.${JUGGLER_VERSION}
spack add eicrecon@git.${EICRECON_VERSION} spack add eicrecon@git.${EICRECON_VERSION}
spack concretize --fresh --force --quiet spack concretize --fresh --force --quiet
make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR="local eics3rw" make --jobs ${jobs} --keep-going --directory /opt/spack-environment SPACK_ENV=${SPACK_ENV} BUILDCACHE_MIRROR_ONLY_PACKAGE="eics3rw" BUILDCACHE_MIRROR_DEPENDENCIES="eicweb ghcr"
ccache --show-stats ccache --show-stats
ccache --zero-stats ccache --zero-stats
EOF EOF
......
mirrors: mirrors:
eicweb:
url: oci://${CI_REGISTRY}/${CI_PROJECT_PATH}/spack-${SPACK_VERSION}
push:
access_pair:
- ${CI_REGISTRY_USER}
- ${CI_REGISTRY_PASSWORD}
ghcr:
url: oci://ghcr.io/eic/spack-${SPACK_VERSION}
push:
access_pair:
- ${GITHUB_REGISTRY_USER}
- ${GITHUB_REGISTRY_TOKEN}
eics3rw: eics3rw:
fetch: fetch:
url: s3://eictest/EPIC/spack/${SPACK_VERSION} url: s3://eictest/EPIC/spack/${SPACK_VERSION}
......
...@@ -7,7 +7,9 @@ export SPACK_COLOR = always ...@@ -7,7 +7,9 @@ export SPACK_COLOR = always
SPACK_ENV ?= dev SPACK_ENV ?= dev
BUILDCACHE_MIRROR := BUILDCACHE_MIRROR_ONLY_PACKAGE :=
BUILDCACHE_MIRROR_DEPENDENCIES :=
BUILDCACHE_OCI_BASE_IMAGE := ghcr.io/eic/debian:stable-slim
.PHONY: all clean .PHONY: all clean
...@@ -18,11 +20,13 @@ include $(SPACK_ENV)/spack.mk ...@@ -18,11 +20,13 @@ include $(SPACK_ENV)/spack.mk
endif endif
$(SPACK_ENV)/push: $(addprefix $(SPACK_ENV)/push/,$($(SPACK_ENV)/SPACK_PACKAGE_IDS)) $(SPACK_ENV)/push: $(addprefix $(SPACK_ENV)/push/,$($(SPACK_ENV)/SPACK_PACKAGE_IDS))
$(foreach buildcache, $(BUILDCACHE_MIRROR), $(SPACK) buildcache update-index $(buildcache) ;) $(foreach buildcache, $(BUILDCACHE_MIRROR_ONLY_PACKAGE), $(SPACK) buildcache update-index $(buildcache) ;)
$(foreach buildcache, $(BUILDCACHE_MIRROR_DEPENDENCIES), $(SPACK) buildcache update-index $(buildcache) ;)
$(SPACK_ENV)/push/%: $(SPACK_ENV)/install/% $(SPACK_ENV)/push/%: $(SPACK_ENV)/install/%
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(foreach buildcache, $(BUILDCACHE_MIRROR), $(SPACK) buildcache push --only=package --unsigned $(buildcache) /$(HASH) ;) # push $(SPEC) $(foreach buildcache, $(BUILDCACHE_MIRROR_ONLY_PACKAGE), $(SPACK) buildcache push --only=package --unsigned $(buildcache) /$(HASH) ;) # push $(SPEC)
$(foreach buildcache, $(BUILDCACHE_MIRROR_DEPENDENCIES), $(SPACK) buildcache push --unsigned --base-image $(BUILDCACHE_OCI_BASE_IMAGE) $(buildcache) /$(HASH) | grep -v "Using cached archive" ;) # push $(SPEC)
@touch $@ @touch $@
$(SPACK_ENV)/spack.lock: $(SPACK_ENV)/spack.yaml Makefile $(SPACK_ENV)/spack.lock: $(SPACK_ENV)/spack.yaml Makefile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment