Skip to content

Commit

Permalink
Change buildcache location to sensei ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
willdunklin committed Jun 18, 2023
1 parent 2c18de6 commit bef3839
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/ci/docker/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tag_date=$(date +%Y%m%d)
tag=$1-$tag_date

base_container=ghcr.io/sensei-insitu/ci-ecp
buildcache_container=ghcr.io/willdunklin/sensei-buildcache
buildcache_container=ghcr.io/sensei-insitu/sensei-buildcache

echo
echo "Building container: $base_container:$tag"
Expand Down
36 changes: 36 additions & 0 deletions .github/ci/docker/cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SENSEI Spack Buildcache

This directory contains the spack binary buildcache for SENSEI's dependencies.

Use of buildcaches speeds up the build process for iterating SENSEI CI containers.

## Extracting a buildcache from a working CI image

SENSEI uses CI docker images to perform automated testing. These CI images are built
using the `build_image.sh` script. Occasionally development needs to be performed on
the CI image themselves, which can be an arduous process given the need to rebuild
SENSEI and all of its dependencies in Spack. To speed up this process, SENSEI uses
buildcaches to speed up the build process.

The `extract_buildcache.sh` script will extract the buildcache from a built SENSEI
CI docker image and create a new minimal docker image containing the buildcache.

To use the `extract_buildcache.sh` script, specify the source CI image you'd like to
extract built binaries from. If no image is specified, the script will use the most
recent `sensei-insitu/ci-ecp` image found locally. The script will then extract the
buildcache to a local volume, and run a docker built to create a new buildcache image.
This image is tagged with the operating system, compiler and architecture of the
source CI image to ensure compatibility.

## How buildcaches are used in SENSEI CI images

SENSEI CI images are built with the `build_image.sh` script. This script builds a CI
docker image based on a preexisting buildcache docker image. The script will identify
the proper buildcache image tag for the CI environment, and attempt to use the
prebuilt binaries if they are available. If the buildcache image is not in the
container registry, it defaults to using the `empty` tagged image.

`build_image.sh` invokes a docker build that uses the buildcache image as an
intermediate layer to mount copy the buildcache into the CI image. The buildcache is
then used speed up the to build the SENSEI CI image. The buildcache is not included
in the final image.
5 changes: 3 additions & 2 deletions .github/ci/docker/cache/extract_buildcache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ echo "Using image: ${IMAGE}"
echo

tag=$(docker run -it --rm --volume "$(pwd):/sensei/cache" ${IMAGE} /sensei/bin/tag.sh | tr -d '\r')
buildcache_container=ghcr.io/willdunklin/sensei-buildcache
buildcache_container=ghcr.io/sensei-insitu/sensei-buildcache

# append the buildcache to the prior version
IMAGE_EXISTS=$(docker manifest inspect $buildcache_container:$tag | grep "layers")
if [[ -n ${IMAGE_EXISTS} ]]; then
echo "Found existing buildcache version: $tag"
Expand All @@ -28,7 +29,7 @@ else
echo "Buildcache version $tag not found, using empty buildcache."
fi

# generate the buildcache
# generate the buildcache from CI image
docker run -it --rm --volume "$(pwd):/sensei/cache" ${IMAGE} \
bin/launch-env.sh \
spack buildcache create --force --allow-root --unsigned /sensei/cache/buildcache
Expand Down
2 changes: 1 addition & 1 deletion .github/ci/docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN /sensei/tmp/install-prereqs.sh
COPY tag.sh /sensei/bin/

# TODO: buildcache logic
FROM ghcr.io/willdunklin/sensei-buildcache:$BUILDCACHE_VERSION AS buildcache
FROM ghcr.io/sensei-insitu/sensei-buildcache:$BUILDCACHE_VERSION AS buildcache

# Install SENSEI deps with spack
FROM init_spack AS build_sensei
Expand Down
6 changes: 5 additions & 1 deletion .github/ci/docker/ubuntu/install-prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ set -xe
export DEBIAN_FRONTEND="noninteractive"
apt-get update -y
apt-get install -y file git curl \
make gcc g++ gfortran \
build-essential software-properties-common \
tar xz-utils bzip2 gzip unzip \
python3 python3-pip ccache \
patch patchelf libtool \
vim

add-apt-repository ppa:ubuntu-toolchain-r/test -y
apt-get update -y
apt-get install -y gcc-11 g++-11 gfortran-11

# Install spack
mkdir -p ${SPACK_ROOT}
cd ${SPACK_ROOT}
Expand Down
5 changes: 3 additions & 2 deletions .github/ci/docker/ubuntu/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ spack:
unify: true
packages:
paraview:
require: '@5.10.1 ~examples~qt+osmesa+shared+development_files use_vtkm=off
build_edition=catalyst_rendering'
require: '@5.11.1 ~examples~qt+catalyst+osmesa+shared+development_files use_vtkm=off build_edition=catalyst_rendering'
mesa:
require: ~glx~llvm
openmpi:
variants: ~static~vt
adios2:
require: '@2.8.3'
all:
require: target=x86_64
providers:
Expand Down
1 change: 1 addition & 0 deletions .github/ci/docker/ubuntu/tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

source ${SPACK_ROOT}/share/spack/setup-env.sh

# echo the compiler/os/arch string for the current environment
spack env activate ${SENSEI_ENV}
SPACK_LOCK=$(dirname $(spack config edit --print-file))/spack.lock
cat ${SPACK_LOCK} | python3 -c \
Expand Down

0 comments on commit bef3839

Please sign in to comment.