OBS: print date/time before git clone and on error

The OBS job clones a lot of repositories from git.osmocom.org every
night, so it is a good candidate to reproduce the "garbage at end of
loose object" error we are getting sporadically.

Print exact timestamps, so we can check if there is anything related in
the server logs, when this error happens again.

Related: OS#4083
Change-Id: Ic9a6d3f0c2b8dad2661ede793c21307f1680a52e
This commit is contained in:
Oliver Smith 2019-07-22 12:04:01 +02:00
parent dcb9edafd4
commit df967f76f6
3 changed files with 15 additions and 3 deletions

View File

@ -89,6 +89,16 @@ osmo_git_last_tags() {
echo "$ret" | cut -d/ -f 3
}
# Pass all arguments to "git clone", but write the current date and time before the clone and on failure.
# This helps analyzing errors with git.osmocom.org (OS#4083).
osmo_git_clone_date() {
date "+%Y-%m-%d %H:%M:%S"
if ! git clone "$@"; then
date "+%Y-%m-%d %H:%M:%S"
exit 1
fi
}
# Print the subdirectory of the repository where the source lies (configure.ac etc.).
# Print nothing when the source is in the topdir of the repository.
osmo_source_subdir() {

View File

@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/common.sh"
. "$(dirname "$0")/common-obs.sh"
# requirements
@ -54,7 +55,7 @@ checkout() {
if [ "$project" = "limesuite" ]; then
[ -d "$project" ] || git clone "https://github.com/myriadrf/LimeSuite" "$project"
else
[ -d "$project" ] || git clone "https://git.osmocom.org/$project"
[ -d "$project" ] || osmo_git_clone_date "https://git.osmocom.org/$project"
fi
cd "$project"
git fetch

View File

@ -1,4 +1,5 @@
#!/bin/bash
. "$(dirname "$0")/common.sh"
. "$(dirname "$0")/common-obs.sh"
# requirements
@ -68,9 +69,9 @@ checkout() {
cd "$REPO"
if [ -n "$branch" ] ; then
git clone "$url/$name" -b "$branch"
osmo_git_clone_date "$url/$name" -b "$branch"
else
git clone "$url/$name"
osmo_git_clone_date "$url/$name"
fi
cd -