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

Correcting file names

parent 59172f98
No related branches found
No related tags found
1 merge request!2CI update to use squashfs
Pipeline #201419 failed
......@@ -52,9 +52,19 @@ variables:
image: ${app_image}
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
.squashfs_var:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
SQUASH_ID: ${CI_MERGE_REQUEST_IID}
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
SQUASH_ID: ${CI_DEFAULT_BRANCH}
.parallel_job:
extends:
- .parallel_definition
- .squashfs_var
variables:
MOUNT_POINT: $(jq -Mc .stack.mount_point stacks/${stack}/config.json)
FAKEHOME: "/scratch/$(id -un)"
......@@ -66,8 +76,8 @@ variables:
--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}"
--fusermount "host:/usr/libexec/apptainer/bin/squashfuse_ll ${CI_DATA}/squashfs-cache/${stack}-${environment}-${SQUASHFS_ID}.sqfs /squashfs"
--fusermount "container: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:
cache:
......
......@@ -9,7 +9,7 @@ if [ "x${CI_DEFAULT_BRANCH}" != "x" ]
then
squash_base=${CI_DEFAULT_BRANCH}
else
squash_base=master
squash_base=main
fi
if [ "x${CI_MERGE_REQUEST_IID}" != "x" ]
......@@ -24,44 +24,54 @@ fi
set -o nounset
if [ -d /squashfs-cache ]
if [ ! -d /squashfs-cache ]
then
mkdir /squashfs-cache
mkdir -p /squashfs-cache
fi
# Check if MR as squashfs
sqfs_image=$(ls -t1 /squashfs-cache/${stack}-${environment}-${squash_id}.sqfs 2> /dev/null | head -1)
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)
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
sqfs_base_image=/squashfs-cache/${stack}-${environment}-${squash_base}-initial.sqfs
mksquashfs /tmp/empty ${sqfs_base_image}
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
sqfs_image=/squashfs-cache/${stack}-${environment}-${squash_id}.sqfs
echo "Linking ${stack}-${environment}-${squash_id}.sqfs -> ${stack}-${environment}-${squash_base}.sqfs"
cd /squashfs-cache
ln -sf $(basename ${sqfs_base_image}) $(basename ${sqfs_image})
cd -
echo "Linking ${sqfs_image} -> ${sqfs_base_image}"
else
if [ ${sqfs_image} != /squashfs-cache/${stack}-${environment}-${squash_id}.sqfs ];
then
cd /squashfs-cache
ln -sf $(basname ${sqfs_image}) ${stack}-${environment}-${squash_id}.sqfs
cd
fi
echo "Found ${sqfs_image}"
fi
if [ -d /overlayfs ]
if [ ! -d /overlayfs ]
then
mkdir -p /overlayfs
fi
if [ -d /overlayfs/upper ]
if [ ! -d /overlayfs/upper ]
then
mkdir -p /overlayfs/upper
mkdir -p /overlayfs/wd
......
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