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: ...@@ -52,9 +52,19 @@ variables:
image: ${app_image} 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: .parallel_job:
extends: extends:
- .parallel_definition - .parallel_definition
- .squashfs_var
variables: variables:
MOUNT_POINT: $(jq -Mc .stack.mount_point stacks/${stack}/config.json) MOUNT_POINT: $(jq -Mc .stack.mount_point stacks/${stack}/config.json)
FAKEHOME: "/scratch/$(id -un)" FAKEHOME: "/scratch/$(id -un)"
...@@ -66,8 +76,8 @@ variables: ...@@ -66,8 +76,8 @@ variables:
--bind ${CI_DATA}/spack-mirror:${MOUNT_POINT}/spack-mirror --bind ${CI_DATA}/spack-mirror:${MOUNT_POINT}/spack-mirror
--bind ${CI_DATA}/squashfs-cache/:/squashfs-cache \ --bind ${CI_DATA}/squashfs-cache/:/squashfs-cache \
--bind ${CI_DATA}/overlayfs:/overlayfs \ --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 "host:/usr/libexec/apptainer/bin/squashfuse_ll ${CI_DATA}/squashfs-cache/${stack}-${environment}-${SQUASHFS_ID}.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 "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: .spack_cache:
cache: cache:
......
...@@ -9,7 +9,7 @@ if [ "x${CI_DEFAULT_BRANCH}" != "x" ] ...@@ -9,7 +9,7 @@ if [ "x${CI_DEFAULT_BRANCH}" != "x" ]
then then
squash_base=${CI_DEFAULT_BRANCH} squash_base=${CI_DEFAULT_BRANCH}
else else
squash_base=master squash_base=main
fi fi
if [ "x${CI_MERGE_REQUEST_IID}" != "x" ] if [ "x${CI_MERGE_REQUEST_IID}" != "x" ]
...@@ -24,44 +24,54 @@ fi ...@@ -24,44 +24,54 @@ fi
set -o nounset set -o nounset
if [ -d /squashfs-cache ] if [ ! -d /squashfs-cache ]
then then
mkdir /squashfs-cache mkdir -p /squashfs-cache
fi fi
# Check if MR as squashfs # 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 ] if [ $? -ne 0 ]
then then
echo "No MR ($squash_id) squashfs found" echo "No MR ($squash_id) squashfs found"
# Check if MR default branch as squashfs # 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 ] if [ $? -ne 0 ]
then then
echo "No default branch ($squash_base) squashfs found" echo "No default branch ($squash_base) squashfs found"
echo "Creating an empty one" echo "Creating an empty one"
mkdir /tmp/empty 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 else
echo "Found ${sqfs_base_image}" echo "Found ${sqfs_base_image}"
fi fi
# Link MR sqaushfs to the one of default branch # Link MR sqaushfs to the one of default branch
ln -sf /squashfs-cache/${stack}-${environment}-${squash_base}.sqfs \ sqfs_image=/squashfs-cache/${stack}-${environment}-${squash_id}.sqfs
/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 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}" echo "Found ${sqfs_image}"
fi fi
if [ -d /overlayfs ] if [ ! -d /overlayfs ]
then then
mkdir -p /overlayfs mkdir -p /overlayfs
fi fi
if [ -d /overlayfs/upper ] if [ ! -d /overlayfs/upper ]
then then
mkdir -p /overlayfs/upper mkdir -p /overlayfs/upper
mkdir -p /overlayfs/wd 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