Skip to content
Snippets Groups Projects
Commit 59172f98 authored by Nicolas Richart's avatar Nicolas Richart
Browse files

Update of CI tu use squashfs in CI to build MR on existing stacks

parent 936b3b20
No related branches found
No related tags found
1 merge request!2CI update to use squashfs
...@@ -17,6 +17,7 @@ workflow: ...@@ -17,6 +17,7 @@ workflow:
variables: variables:
TERM: ansi TERM: ansi
CI_DATA: "/work/scitas-ge/richart/ci"
.parallel_definition: .parallel_definition:
parallel: parallel:
...@@ -55,12 +56,18 @@ variables: ...@@ -55,12 +56,18 @@ variables:
extends: extends:
- .parallel_definition - .parallel_definition
variables: variables:
MOUNT_POINT: /ssoft/spack MOUNT_POINT: $(jq -Mc .stack.mount_point stacks/${stack}/config.json)
BUILDCACHE: "/work/scitas-ge/richart/ci/buildcache" FAKEHOME: "/scratch/$(id -un)"
MIRROR: "/work/scitas-ge/richart/ci/mirror"
FAKEHOME: "/scratch/richart"
COMMAND_OPTIONS_SBATCH: ${slurm_options} COMMAND_OPTIONS_SBATCH: ${slurm_options}
APPTAINER_EXEC_OPTIONS: ${apptainer_options} --cleanenv -H $(mktemp -d -p ${FAKEHOME}/):/home/richart --bind ${BUILDCACHE}:/buildcache:rw --bind ${MIRROR}:${MOUNT_POINT}/spack-mirror:rw --bind ${CI_PROJECT_DIR}:${MOUNT_POINT} --bind /dev/tty STACK_VERSION: $(jq -Mc .stack.version stacks/${stack}/config.json)
APPTAINER_EXEC_OPTIONS: >- ${apptainer_options} --cleanenv
-H $(mktemp -d -p ${FAKEHOME}/):/home/$(id -un)
--bind ${CI_DATA}/buildcache:${MOUNT_POINT}/buildcache
--bind ${CI_DATA}/spack-mirror:${MOUNT_POINT}/spack-mirror
--bind ${CI_DATA}/squashfs-cache/:/squashfs-cache \
--bind ${CI_DATA}/overlayfs:/overlayfs \
--fusermount "host:/usr/libexec/apptainer/bin/squashfuse_ll ${CI_DATA}/squashfs-cache/${stack}-${environment}-${CI_MERGE_REQUEST_IID}.sqfs /squashfs"
--fusermount "conqtainer:fuse-overlayfs -o squash_to_uid=$(id -n) -o squash_to_gid=$(id -g) -o lowerdir=/squashfs -o upperdir=/overlayfs/upper -o workdir=/overlayfs/wd ${MOUNT_POINT}/${stack}/${environment}/${STACK_VERSION}"
.spack_cache: .spack_cache:
cache: cache:
...@@ -73,12 +80,18 @@ variables: ...@@ -73,12 +80,18 @@ variables:
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
spack:checkout: spack:checkout:
stage: .pre stage: .pre
variables:
APPTAINER_EXEC_OPTIONS: --cleanenv --bind ${CI_DATA}
extends: extends:
- .parallel_definition - .parallel_definition
before_script: before_script:
- git config --global --add --bool advice.detachedHead false - git config --global --add --bool advice.detachedHead false
script: script:
- ls - mkdir -p ${CI_DATA}/overlayfs
- mkdir -p ${CI_DATA}/squashfs-cache
- mkdir -p ${CI_DATA}/buildcache
- mkdir -p ${CI_DATA}/spack-mirror
- ./ci/prepare_squashfs.sh
timeout: 1h timeout: 1h
spack:setup: spack:setup:
...@@ -114,8 +127,12 @@ spack:concretize: ...@@ -114,8 +127,12 @@ spack:concretize:
- .spack_cache - .spack_cache
script: script:
- source ci/stack_env.sh - source ci/stack_env.sh
- ${STACK_LOCATION}/spack/bin/spack -e ${environment} config blame | tee config-${environment}-${stack}.log
- ${STACK_LOCATION}/spack/bin/spack -e ${environment} concretize | tee concretize-${environment}-${stack}.log - ${STACK_LOCATION}/spack/bin/spack -e ${environment}
config blame | tee config-${environment}-${stack}.log
- ${STACK_LOCATION}/spack/bin/spack -e ${environment}
concretize | tee concretize-${environment}-${stack}.log
- cp ${SPACK_SYSTEM_CONFIG_PATH}/spack.lock spack-${environment}-${stack}.lock - cp ${SPACK_SYSTEM_CONFIG_PATH}/spack.lock spack-${environment}-${stack}.lock
artifacts: artifacts:
...@@ -137,18 +154,18 @@ spack:install: ...@@ -137,18 +154,18 @@ spack:install:
- echo "{}" > spack-install-${environment}.xml - echo "{}" > spack-install-${environment}.xml
- ${STACK_LOCATION}/spack/bin/spack -e ${environment} install - ${STACK_LOCATION}/spack/bin/spack -e ${environment} install
--log-file spack-install-${environment}.xml --log-file spack-install-${environment}.xml
--log-format junit --log-format junit
--only-concrete --only-concrete
--fail-fast --fail-fast
--show-log-on-error --show-log-on-error
- ${STACK_LOCATION}/spack/bin/spack -e ${environment} find -vl | tee spack-find-${environment}-${stack}.log - ${STACK_LOCATION}/spack/bin/spack -e ${environment} find -vl | tee spack-find-${environment}-${stack}.log
- ${STACK_LOCATION}/spack/bin/spack -e ${environment} - ${STACK_LOCATION}/spack/bin/spack -e ${environment}
buildcache create buildcache create
--update-index --update-index
--key EDC904DCE3D2E84E --key EDC904DCE3D2E84E
/buildcache ${MOUNT_POINT}/buildcache
needs: needs:
- job: spack:concretize - job: spack:concretize
artifacts: artifacts:
......
...@@ -53,7 +53,7 @@ for c in "core_compilers" "compilers"; do ...@@ -53,7 +53,7 @@ for c in "core_compilers" "compilers"; do
${STACK_LOCATION}/spack/bin/spack buildcache create \ ${STACK_LOCATION}/spack/bin/spack buildcache create \
--update-index \ --update-index \
--key EDC904DCE3D2E84E \ --key EDC904DCE3D2E84E \
/buildcache ${hashes} ${MOUNT_POINT}/buildcache ${hashes}
for compiler_hash in $(echo ${hashes}); do for compiler_hash in $(echo ${hashes}); do
location=$(${STACK_LOCATION}/spack/bin/spack location -i ${compiler_hash}) location=$(${STACK_LOCATION}/spack/bin/spack location -i ${compiler_hash})
......
#!/usr/bin/env sh
set -o pipefail
source ${CI_PROJECT_DIR}/ci/stack_env.sh
if [ "x${CI_DEFAULT_BRANCH}" != "x" ]
then
squash_base=${CI_DEFAULT_BRANCH}
else
squash_base=master
fi
if [ "x${CI_MERGE_REQUEST_IID}" != "x" ]
then
squash_id=${CI_MERGE_REQUEST_IID}
elif [ "x${CI_COMMIT_BRANCH}" != "x" ]
then
squash_id=${CI_MERGE_REQUEST_IID}
else
squash_id="local"
fi
set -o nounset
if [ -d /squashfs-cache ]
then
mkdir /squashfs-cache
fi
# Check if MR as squashfs
sqfs_image=$(ls -t1 /squashfs-cache/${stack}-${environment}-${squash_id}.sqfs 2> /dev/null | head -1)
if [ $? -ne 0 ]
then
echo "No MR ($squash_id) squashfs found"
# Check if MR default branch as squashfs
sqfs_base_image=$(ls -t1 /squashfs-cache/${stack}-${environment}-${squash_base}.sqfs 2> /dev/null | head -1)
if [ $? -ne 0 ]
then
echo "No default branch ($squash_base) squashfs found"
echo "Creating an empty one"
mkdir /tmp/empty
mksquashfs /tmp/empty /squashfs-cache/${stack}-${environment}-${squash_base}.sqfs
else
echo "Found ${sqfs_base_image}"
fi
# Link MR sqaushfs to the one of default branch
ln -sf /squashfs-cache/${stack}-${environment}-${squash_base}.sqfs \
/squashfs-cache/${stack}-${environment}-${squash_id}.sqfs
echo "Linking ${stack}-${environment}-${squash_id}.sqfs -> ${stack}-${environment}-${squash_base}.sqfs"
else
echo "Found ${sqfs_image}"
fi
if [ -d /overlayfs ]
then
mkdir -p /overlayfs
fi
if [ -d /overlayfs/upper ]
then
mkdir -p /overlayfs/upper
mkdir -p /overlayfs/wd
fi
...@@ -147,9 +147,9 @@ echo "Setting up buildcache" ...@@ -147,9 +147,9 @@ echo "Setting up buildcache"
spack/bin/spack gpg trust \ spack/bin/spack gpg trust \
$GPG_PRIVATE_KEY $GPG_PRIVATE_KEY
if [ ! -d /buildcache/build_cache ]; then if [ ! -d ${MOUNT_POINT}/buildcache/build_cache ]; then
spack/bin/spack gpg publish \ spack/bin/spack gpg publish \
-d /buildcache -d ${MOUNT_POINT}/buildcache
fi fi
if ! spack/bin/spack mirror list | grep buildcache; then if ! spack/bin/spack mirror list | grep buildcache; then
...@@ -157,7 +157,7 @@ if ! spack/bin/spack mirror list | grep buildcache; then ...@@ -157,7 +157,7 @@ if ! spack/bin/spack mirror list | grep buildcache; then
spack/bin/spack mirror add \ spack/bin/spack mirror add \
--type binary \ --type binary \
--scope system \ --scope system \
buildcache file:///buildcache buildcache file://${MOUNT_POINT}/buildcache
fi fi
spack/bin/spack buildcache keys \ spack/bin/spack buildcache keys \
......
...@@ -10,8 +10,8 @@ export STACK_LOCATION=${MOUNT_POINT}/${stack}/${environment}/${STACK_VERSION} ...@@ -10,8 +10,8 @@ export STACK_LOCATION=${MOUNT_POINT}/${stack}/${environment}/${STACK_VERSION}
export SPACK_SYSTEM_CONFIG_PATH=${STACK_LOCATION}/spack/var/spack/environments/${environment} export SPACK_SYSTEM_CONFIG_PATH=${STACK_LOCATION}/spack/var/spack/environments/${environment}
export SPACK_USER_CACHE_PATH=$(mktemp -p /tmp -d slurm_user_cache_XXXXXXX) #export SPACK_USER_CACHE_PATH=$(mktemp -p /tmp -d slurm_user_cache_XXXXXXX)
export SPACK_USER_CONFIG_PATH=$(mktemp -p /tmp -d slurm_user_config_XXXXXXX) #export SPACK_USER_CONFIG_PATH=$(mktemp -p /tmp -d slurm_user_config_XXXXXXX)
export environment_type="local_cluster" export environment_type="local_cluster"
...@@ -21,5 +21,5 @@ echo "SPACK_VERSION: ${SPACK_VERSION}" ...@@ -21,5 +21,5 @@ echo "SPACK_VERSION: ${SPACK_VERSION}"
echo "MOUNT_POINT: ${MOUNT_POINT}" echo "MOUNT_POINT: ${MOUNT_POINT}"
echo "STACK_LOCATION: ${STACK_LOCATION}" echo "STACK_LOCATION: ${STACK_LOCATION}"
echo "SPACK_SYSTEM_CONFIG_PATH: ${SPACK_SYSTEM_CONFIG_PATH}" echo "SPACK_SYSTEM_CONFIG_PATH: ${SPACK_SYSTEM_CONFIG_PATH}"
echo "SPACK_USER_CACHE_PATH: ${SPACK_USER_CACHE_PATH}" # echo "SPACK_USER_CACHE_PATH: ${SPACK_USER_CACHE_PATH}"
echo "SPACK_USER_CONFIG_PATH: ${SPACK_USER_CONFIG_PATH}" # echo "SPACK_USER_CONFIG_PATH: ${SPACK_USER_CONFIG_PATH}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment