Commit a66c0073 authored by Belhorn, Matt's avatar Belhorn, Matt
Browse files

Cleans Spack build area of failed build remnants.

Spack builds that fail can sometimes leave staged source files and CMake
caches in the build area. These are cleaned up when builds are
successful, but are left around when builds fail to allow for
post-mortem analysis of the build errors.

There is a small possibility that new builds will have the same unique
hash as previous builds, even if details of the build have changed. In
this case, old source and CMake caches from the previous faild build
attempt may be re-used for the new build. This is almost always
undesired.

We can just go ahead and clean the spack build staging directory of any
cruft prior to attempting a new build to avoid this, while also keeping
these staged artifacts after build failures for study.

Latest versions of spack can clean the staging directory with the
command:

```
spack clean --stage --misc-cache
```

but older versions used the command:

```
spack purge --stage --misc-cache
```

in case this error re-appears when using older Spack v0.10 or earlier.

This commit also adds annotation to the deployment scripts explaining
the purpose of each of the spack setup and build steps.
parent 87fb3fe5
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -17,26 +17,37 @@ set -x
SW_ROOT=/sw/summitdev/container-builder/${VERSION}
mkdir -p ${SW_ROOT}

# Build with spack; install spack if it's not already present.
SPACKROOT=${SW_ROOT}/.spack

if [ ! -d ${SPACKROOT} ]; then
	git clone https://github.com/spack/spack.git ${SPACKROOT}
	cd ${SPACKROOT}
	git checkout d3519af7de84fa72dee0618c7754f7ebeaa23142
	cd ${HOME}
fi

# Update the spack configuration files to the latest.
cp spack-etc-summitdev/*.yaml ${SPACKROOT}/etc/spack

# Ensure spack is aware of our third-party package repo.
${SPACKROOT}/bin/spack repo add spack-repo/container-builder

# Remove any remnants of past failed builds.
${SPACKROOT}/bin/spack clean --stage --misc-cache

# Record how spack will build the app in the log.
${SPACKROOT}/bin/spack spec -NIl "container-builder%gcc@7.1.0"

# Have spack build the app.
${SPACKROOT}/bin/spack install "container-builder%gcc@7.1.0"

# Find where spack generated the modulefile.
root=$(${SPACKROOT}/bin/spack config get config | grep "\btcl:" | awk '{print $2}' | sed 's/^$spack/./')
arch=$(${SPACKROOT}/bin/spack arch)
mfname=$(${SPACKROOT}/bin/spack module find "container-builder%gcc@7.1.0")

real_mf_path="$SPACKROOT/$root/$arch/$mfname"

# Generate a public modulefile the loads the spack-generated one.
MF_ROOT=/sw/summitdev/modulefiles/core/container-builder
mkdir -p ${MF_ROOT}

+14 −3
Original line number Diff line number Diff line
@@ -18,26 +18,37 @@ unset CRAYPE_VERSION
SW_ROOT=/sw/xk6/container-builder/${VERSION}
mkdir -p ${SW_ROOT}

# Build with spack; install spack if it's not already present.
SPACKROOT=${SW_ROOT}/.spack

if [ ! -d ${SPACKROOT} ]; then
	git clone https://github.com/spack/spack.git ${SPACKROOT}
	cd ${SPACKROOT}
	git checkout d3519af7de84fa72dee0618c7754f7ebeaa23142
	cd ${HOME}
fi

# Update the spack configuration files to the latest.
cp spack-etc-titan/*.yaml ${SPACKROOT}/etc/spack

# Ensure spack is aware of our third-party package repo.
${SPACKROOT}/bin/spack repo add spack-repo/container-builder

# Remove any remnants of past failed builds.
${SPACKROOT}/bin/spack clean --stage --misc-cache

# Record how spack will build the app in the log.
${SPACKROOT}/bin/spack spec -NIl "container-builder%gcc@5.3.0"

# Have spack build the app.
${SPACKROOT}/bin/spack install "container-builder%gcc@5.3.0"

# Find where spack generated the modulefile.
root=$(${SPACKROOT}/bin/spack config get config | grep "\btcl:" | awk '{print $2}' | sed 's/^$spack/./')
arch=$(${SPACKROOT}/bin/spack arch)
mfname=$(${SPACKROOT}/bin/spack module find "container-builder%gcc@5.3.0")

real_mf_path="$SPACKROOT/$root/$arch/$mfname"

# Generate a public modulefile the loads the spack-generated one.
MF_ROOT=/sw/xk6/modulefiles/container-builder
mkdir -p ${MF_ROOT}