Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
unpacked
sync
Commits
214758cc
Commit
214758cc
authored
Jan 29, 2019
by
Simone Mosciatti
Browse files
add logic for error in gitlab
parent
5b714a00
Changes
1
Hide whitespace changes
Inline
Side-by-side
loop.sh
View file @
214758cc
#!/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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment