[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH OSSTEST v2 2/5] Handle osstest's own local push gate in non-master production instances



We want to arrange that the master XenProject instance continues to
test its own pretest branch while any downstream instances will pickup
changes from the master instance's production (i.e. tested) branch,
which is published at git://xenbits.xen.org/osstest.git#master.

Add a new configuration option OsstestUpstream which by default is
"git://xenbits.xen.org/osstest.git master" and which is cleared to
nothing on the master instance via production-config.

If the option is not set then the existing behaviour is unchanged.

If the option is set then osstest branch flights proceed by merging,
the referenced branch into the local pretest branch and testing the
result.

This must be done:
 - in a clone not in the main testing.git in order to avoid inserting
   merge conflict markers into the active set of scripts.
 - in a non-bare repo because git merge requires it.

$repos/osstest is a bare repo which we want to keep that way because
using repo_tree_rev_fetch_git to fetch the remote branch is
convenient.

So we use $repos/osstest-merge as a temporary merge repo and reclone
from the active local repo each time.

All of this happens in ap-fetch version which also fetches the result
into FETCH_HEAD into the active repo (the one running the test), such
that the existing hard reset in cr-daily-branch can find the commit.

If the merge fails then manual intervention (i.e. a manual merge and
push to the _local_ pretest) will be required.

In ap-push we stop pushing to xenbits#master except for the master
instance if an upstream is defined. At some point it might be useful
to add a configuration option for where to push to but I don't have
that requirement right now.

ap-fetch-version-old requires no changes.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
v2:
 - Arrange for $OSSTEST_USE_HEAD=y to take precendence
 - drop LOCALREV (which was wrong anyway) in favour of inline
   branchname
 - Rename OSSTEST_REVISION_MERGE as revision_merge to avoid implying
   it can be set and will be honoured.
 - Git in Debian Squeeze lacks -C and --no-edit, adjust accordingly.
---
 Osstest.pm        |  2 ++
 ap-common         |  2 ++
 ap-fetch-version  | 25 ++++++++++++++++++++++---
 ap-push           |  8 +++++++-
 production-config |  2 ++
 5 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/Osstest.pm b/Osstest.pm
index 7989129..7f72bc6 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -102,6 +102,8 @@ sub readglobalconfig () {
     return if $readglobalconfig_done;
     $readglobalconfig_done=1;
 
+    $c{OsstestUpstream} = 'git://xenbits.xen.org/osstest.git master';
+
     $c{HostProp_DhcpWatchMethod} = 'leases dhcp3 infra:5556';
     $c{AuthorizedKeysFiles} = '';
     $c{AuthorizedKeysAppend} = '';
diff --git a/ap-common b/ap-common
index 64749e3..de7bb1d 100644
--- a/ap-common
+++ b/ap-common
@@ -21,6 +21,8 @@
 
 : ${XENBITS:=osstest@xxxxxxxxxxxxxxx}
 
+: ${TREEBRANCH_OSSTEST_UPSTREAM=`getconfig OsstestUpstream`}
+
 : ${TREE_XEN:=git://xenbits.xen.org/xen.git}
 : ${PUSH_TREE_XEN:=$XENBITS:/home/xen/git/xen.git}
 
diff --git a/ap-fetch-version b/ap-fetch-version
index 33aaf00..ee502c6 100755
--- a/ap-fetch-version
+++ b/ap-fetch-version
@@ -90,11 +90,30 @@ ovmf)
                $TREE_OVMF_UPSTREAM master $LOCALREV_OVMF
        ;;
 osstest)
-       if [ "x$OSSTEST_USE_HEAD" != "xy" ] ; then
+       if [ "x$OSSTEST_USE_HEAD" = "xy" ] ; then
+           git rev-parse HEAD^0
+       elif [ x"$TREEBRANCH_OSSTEST_UPSTREAM" != x ] ; then
+           revision_merge=`repo_tree_rev_fetch_git osstest \
+               $TREEBRANCH_OSSTEST_UPSTREAM daily-cron.$branch`
+           echo >&2 "$TREEBRANCH_OSSTEST_UPSTREAM = $revision_merge"
+
+           rm -rf $repos/osstest-merge >&2
+           git clone -b pretest $HOME/testing.git $repos/osstest-merge >&2
+
+           (
+           cd $repos/osstest-merge
+           git fetch $repos/osstest daily-cron.$branch:ap-merge >&2
+           git merge \
+               -m "Automerge of $TREEBRANCH_OSSTEST_UPSTREAM into pretest" \
+               ap-merge >&2
+            )
+
+           # cr-daily-branch will reset the local tree to this version.
+           git fetch $repos/osstest-merge pretest
+           git rev-parse FETCH_HEAD^0
+       else
            git fetch $HOME/testing.git pretest:ap-fetch >&2
             git rev-parse ap-fetch^0
-       else
-           git rev-parse HEAD^0
        fi
         ;;
 *)
diff --git a/ap-push b/ap-push
index c141464..5967b42 100755
--- a/ap-push
+++ b/ap-push
@@ -99,7 +99,13 @@ ovmf)
        ;;
 osstest)
        git push $HOME/testing.git $revision:production
-       git push $XENBITS:/home/xen/git/osstest.git $revision:master
+       if [ x"$TREEBRANCH_OSSTEST_UPSTREAM" != x ] ; then
+           # could push to instance specific location, but
+           # certainly not to master instance's xenbits repo!
+           :
+       else
+           git push $XENBITS:/home/xen/git/osstest.git $revision:master
+       fi
        ;;
 *)
        echo >&2 "branch $branch ?"
diff --git a/production-config b/production-config
index 8f20c27..84a3bb7 100644
--- a/production-config
+++ b/production-config
@@ -15,6 +15,8 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# This is the master instance, therefore it has no upstream
+OsstestUpstream ''
 
 JobDB Executive
 HostDB Executive
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.