diff mbox

[Xen-devel,OSSTEST] Tollerate outages of git://git.sv.gnu.org/gnulib.git

Message ID 1400583276-6873-1-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell May 20, 2014, 10:54 a.m. UTC
gnulib is a bit special in that it isn't part of a push gate and therefore
doesn't have an output repo on xenbits. This means that if git.sv.gnu.org is
down for some reason then any flight which uses it will potentially fail, even
ones which are not specifically trying to test gnulib.git. Normally unrelated
flights are isolated from 3rd party failures because they use the relevant push
gates' outputs.

The git-proxy which we use supports passing [fetch=try] as an option which will
cause it to try and fetch from upstream and fall back to the cached version if
upstream does not respond. This is exactly what we want for gnulib.git. Proxy
options in the URL are separate with a space which we encode here as %20 to
avoid having to go around adding quotes to all the uses of shell variables
which contain a URL.

Provide a helper shell function cached_repo which conditionally arranges for
the given repo to be cached with the given options only if the osstest config
sets GitCacheProxy, so as not to break uses of osstest outside of the
production environment where a cache may not be available (of course such uses
will then be subject to outages of 3rd party repos)

It was also necessary to make repo_tree_rev_fetch_git idempotent WRT the proxy
prefix to avoid trying to clone
git://proxy/git://proxy/git://some.real.domain/foo.git.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 README.dev |  6 +++++-
 ap-common  |  2 +-
 cri-common | 17 ++++++++++++++++-
 3 files changed, 22 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/README.dev b/README.dev
index 68fbe67..fd09766 100644
--- a/README.dev
+++ b/README.dev
@@ -21,7 +21,11 @@  $ ./mg-allocate \!marilith-n5
 Removing machines for servicing/outage
 ======================================
 
-mg-blockage
+mg-blockage <date-from> <date-to> <hostflag> [<extra-xinfo>]
+OSSTEST_CONFIG=production-config ./mg-blockage '2014-05-21 0955' '2014-05-21 1400' equiv-marilith
+
+
+Keeps running for the duration, so run it in a screen on the osstest VM.
 
 Commisioning a new machine
 ==========================
diff --git a/ap-common b/ap-common
index 537f605..b4b3310 100644
--- a/ap-common
+++ b/ap-common
@@ -37,7 +37,7 @@ 
 : ${PUSH_TREE_LIBVIRT:=$XENBITS:/home/xen/git/libvirt.git}
 : ${BASE_TREE_LIBVIRT:=git://xenbits.xen.org/libvirt.git}
 
-: ${TREE_GNULIB_LIBVIRT:=git://git.sv.gnu.org/gnulib.git}
+: ${TREE_GNULIB_LIBVIRT:=$(cached_repo git://git.sv.gnu.org/gnulib.git \[fetch=try\])}
 
 : ${TREE_RUMPUSERXEN:=https://github.com/rumpkernel/rumpuser-xen}
 : ${TREEVCS_RUMPUSERXEN:=git}
diff --git a/cri-common b/cri-common
index ea312f2..9cbf0d8 100644
--- a/cri-common
+++ b/cri-common
@@ -21,14 +21,29 @@ 
 
 umask 002
 
+cached_repo () {
+	local repo=$1
+	local options=$2
+	local cache=`getconfig GitCacheProxy`
+
+	if [ x$cache != x ] ; then
+		echo "$cache$repo%20$options"
+	else
+		echo "$repo"
+	fi
+}
+
 repo_tree_rev_fetch_git () {
 	local treename=$1
 	local remoteurl=$2
 	local remotetag=$3
 	local localtag=$4
+	local proxy=`getconfig GitCacheProxy`
 	case $remoteurl in
+	$proxy*)
+		local realurl="$remoteurl" ;;
 	git://*|http://*|https://*)
-		local realurl="`getconfig GitCacheProxy`$remoteurl" ;;
+		local realurl="$proxy$remoteurl" ;;
 	*)
 		local realurl="$remoteurl" ;;
 	esac