Commit 214758cc authored by Simone Mosciatti's avatar Simone Mosciatti
Browse files

add logic for error in gitlab

parent 5b714a00
#!/bin/bash
# this script update the recipe file via git and, on loop it execute the ducc conversion.
# in case of repeated errors it send an email and exit
error_count=0
while true
do
git --version > /dev/null 2>&1 || { echo "git is required but it is not installed. Aborting."; exit 1; }
ducc version > /dev/null 2>&1 || { echo "ducc is required but it is not installed. Aborting."; exit 1; }
git clone ssh://git@gitlab.cern.ch:7999/unpacked/sync.git unpacked > /dev/null
pushd unpacked
git pull origin master || { echo "error in pulling the repository"; exit 1;}
popd
update_error_count=0
while true
do
# if for 3 times was no possible to update the repository we send an email and we exit.
if [ $update_error_count -ge 3 ]; then
echo "" | mail -s "[unpacked.cern.ch] Error on contacting the gitlab repository" -t simone.mosciatti@cern.ch
exit 2;
fi
(git clone ssh://git@gitlab.cern.ch:7999/unpacked/sync.git unpacked > /dev/null)
pushd unpacked
(git pull origin master)
pull_status=$?
popd
if [ $pull_status -eq 0 ]; then
break;
else
$update_error_count=$(( update_error_count+1))
fi
done
(ducc convert unpacked/recipe.yaml)
conversion_status=$?
......@@ -22,7 +42,7 @@ do
echo "Error: $conversion_status"
echo "error_count: $error_count"
if [ $error_count -ge 10 ]; then
echo "" | mail -s "Error on unpacked.cern.ch $conversion_status" simone.mosciatti@cern.ch
echo "" | mail -s "[unpacked.cern.ch] Error on unpacked.cern.ch $conversion_status" -t simone.mosciatti@cern.ch
exit 1
fi
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment