Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix checks for read/write access using eessi_container.sh script #227

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 75 additions & 8 deletions .github/workflows/test_eessi_container_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:
matrix:
SCRIPT_TEST:
- help
- run
- shell
- container
- resume
# FIXME disabled because '--access rw' is not working in CI environment
#- readwrite
#- save
# - run
# - shell
# - container
# - resume
# - readwrite
# - build_container
# - rwdeb10
# - save
steps:
- name: Check out software-layer repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
Expand All @@ -30,6 +31,7 @@ jobs:
run: |
mount
df -h
cat /etc/apptainer/apptainer.conf

- name: Test eessi_container.sh script
run: |
Expand Down Expand Up @@ -63,19 +65,84 @@ jobs:
grep "Debian GNU/Linux 10" ${outfile}

# test use of '--access rw' to get write access in container
elif [[ ${{matrix.SCRIPT_TEST}} == 'readwrite' ]]; then
elif [[ ${{matrix.SCRIPT_TEST}} == readwrite ]]; then
outfile0=out_readwrite0.txt
outfile=out_readwrite.txt
fn="test_${RANDOM}.txt"
echo "ls -lisa /cvmfs /cvmfs/pilot.eessi-hpc.org" > explore_script.sh
echo "id" >> explore_script.sh
echo "mount" >> explore_script.sh
echo "df -h" >> explore_script.sh
echo "cat /etc/fuse.conf" >> explore_script.sh
echo "dpkg -S /etc/fuse.conf" >> explore_script.sh
echo "dpkg -L fuse3" >> explore_script.sh
echo "fuse-overlayfs -V" >> explore_script.sh
echo "uname -a" >> explore_script.sh
chmod +x explore_script.sh
echo "touch /cvmfs/pilot.eessi-hpc.org/${fn}" > test_script.sh
chmod u+x test_script.sh
export SINGULARITY_BIND="$PWD:/test"
singularity version
./eessi_container.sh --verbose --access rw --mode run /test/explore_script.sh 2>&1 | tee -a ${outfile0}
./eessi_container.sh --verbose --access rw --mode run /test/test_script.sh > ${outfile}

tmpdir=$(grep "\-\-resume" ${outfile} | sed "s/.*--resume \([^']*\).*/\1/g")
# note: must use '--access rw' again here, since touched file is in overlay upper dir
./eessi_container.sh --verbose --resume ${tmpdir} --access rw --mode shell <<< "ls -l /cvmfs/pilot.eessi-hpc.org/${fn}" > ${outfile}
grep "/cvmfs/pilot.eessi-hpc.org/${fn}$" $outfile

# test use of build_container.sh script
elif [[ ${{matrix.SCRIPT_TEST}} == build_container ]]; then
outfile0=out_readwrite0.txt
outfile=out_readwrite.txt
fn="test_${RANDOM}.txt"
echo "ls -lisa /cvmfs /cvmfs/pilot.eessi-hpc.org" > explore_script.sh
echo "id" >> explore_script.sh
echo "mount" >> explore_script.sh
echo "df -h" >> explore_script.sh
echo "cat /etc/fuse.conf" >> explore_script.sh
echo "dpkg -S /etc/fuse.conf" >> explore_script.sh
echo "dpkg -L fuse3" >> explore_script.sh
echo "fuse-overlayfs -V" >> explore_script.sh
echo "uname -a" >> explore_script.sh
chmod +x explore_script.sh
echo "touch /cvmfs/pilot.eessi-hpc.org/${fn}" > test_script.sh
chmod u+x test_script.sh
cp -a * /tmp/
cd /tmp
# export SINGULARITY_BIND="$PWD:/test"
singularity version
./build_container.sh run /tmp/$USER/EESSI /tmp/explore_script.sh
./build_container.sh run /tmp/$USER/EESSI /tmp/test_script.sh

# test use of '--access rw' to get write access in container
elif [[ ${{matrix.SCRIPT_TEST}} == rwdeb10 ]]; then
outfile0=out_readwrite0.txt
outfile=out_readwrite.txt
fn="test_${RANDOM}.txt"
container="docker://ghcr.io/eessi/build-node:debian10"
echo "ls -lisa /cvmfs /cvmfs/pilot.eessi-hpc.org" > explore_script.sh
echo "id" >> explore_script.sh
echo "mount" >> explore_script.sh
echo "df -h" >> explore_script.sh
echo "cat /etc/fuse.conf" >> explore_script.sh
echo "dpkg -S /etc/fuse.conf" >> explore_script.sh
echo "dpkg -L fuse3" >> explore_script.sh
echo "fuse-overlayfs -V" >> explore_script.sh
echo "uname -a" >> explore_script.sh
chmod +x explore_script.sh
echo "touch /cvmfs/pilot.eessi-hpc.org/${fn}" > test_script.sh
chmod u+x test_script.sh
export SINGULARITY_BIND="$PWD:/test"
singularity version
./eessi_container.sh --verbose --container ${container} --access rw --mode run /test/explore_script.sh 2>&1 | tee -a ${outfile0}
./eessi_container.sh --verbose --container ${container} --access rw --mode run /test/test_script.sh > ${outfile}

tmpdir=$(grep "\-\-resume" ${outfile} | sed "s/.*--resume \([^']*\).*/\1/g")
# note: must use '--access rw' again here, since touched file is in overlay upper dir
./eessi_container.sh --verbose --container ${container} --resume ${tmpdir} --access rw --mode shell <<< "ls -l /cvmfs/pilot.eessi-hpc.org/${fn}" > ${outfile}
grep "/cvmfs/pilot.eessi-hpc.org/${fn}$" $outfile

# test use of --resume
elif [[ ${{matrix.SCRIPT_TEST}} == 'resume' ]]; then
outfile=out_resume.txt
Expand Down