summaryrefslogtreecommitdiff
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-05-04 05:21:01 (GMT)
committer Norbert Thiebaud <nthiebaud@gmail.com>2012-05-04 05:22:41 (GMT)
commit6670aa7193c3a629e2f1477fe56e9b4b2dfd5ab6 (patch) (side-by-side diff)
tree1a79fd7036f40ca00a02ee79a1d57251b88dd6ed
parent3e5b5c06343ebbf80a4a9952ff52a0031d54898e (diff)
downloadbuildbot-master.zip
buildbot-master.tar.gz
add support for for/ref gerrit one-shot build with notificationHEADmaster
This presume that .ssh/config define 'gerrit' properly so that ssh gerrit point to gerrit with the right user, key and port usage: in a core repo, with a profile who's autogen.lastrun limit the build to the core repo (no help/no dict/no binfilter and no i10n) tinbuild2 -p gerrit -g refs/changes/x/y/z (as provided in the gerrit gui) this will essentialy check out that change in a headless branch, build it like for a 'prime build' and notify gerrit of the result via the gerrit review command line TODO: notify at the bebeggin too to announce the start of the test-build This will eventually be able to be controled via a daemon that will monitor which patcheset need building and submit such tinbuild2 commands as needed
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xbin/tinbuild231
-rw-r--r--bin/tinbuild_internals.sh7
2 files changed, 30 insertions, 8 deletions
diff --git a/bin/tinbuild2 b/bin/tinbuild2
index 24f6bba..da69590 100755
--- a/bin/tinbuild2
+++ b/bin/tinbuild2
@@ -18,6 +18,8 @@ CHECK=0
FORCE_REBUILD=0
METADATA_DIR="."
WATCHDOG=
+GERRIT_REF=
+DO_NOT_CLEAN=
# load the internal functions. note that
# tinderbuild_internals_<uname>.sh is sourced at the tail
@@ -96,6 +98,8 @@ Options:
-a <email> 'author'. This is for branch that are not under tb supervision. that is the email of the
'author' of the branch. email are sent to that email address for sucess and failure
-c sanity check (verify that tou configuration is sane and send a test email)
+ -d <timeout_attemps> wrap make commands in a watchdog that will interrupt them if they get stuck for <timeout>
+ -g <ref> gerrit ref to build, like refs/changes/02/102/1 see gerrit download checkout information
-i run with ionice -c3, can be combined with -n
-k to not override autogen.lastrun if present (usefull with -z to do a quick test)
-m [all,tb,owner,author,none]
@@ -113,7 +117,6 @@ Options:
-v verbose. print more progress messages
-w specify minimum wait between build attempt
-z bootstrap/prime the tinbuild
- -d "<timeout> <attempts>" wrap make commands in a watchdog that will interrupt them if they get stuck
EOF
}
@@ -225,14 +228,16 @@ sanity_check()
# Main
#
-while getopts a:b:cd:efhiknm:p:r:tvw:z opt ; do
+while getopts 0a:b:cd:efg:hiknm:p:r:tvw:z opt ; do
case "$opt" in
+ 0) DO_NOT_CLEAN=1 ;; # avoid calling *_clean functions (incremental build)
a) BRANCH_AUTHOR="$OPTARG" ;; # email to the branch's author for out-of-tinderbox branch buildbot
b) BRANCH="$OPTARG";; # to override the branch name to use
- e) LOCK=0 ;; # whether to use flock to protect the build-cycle
c) CHECK=1 ;; # whether to invoke the sanity-check function
d) WATCHDOG="makewatchdog $OPTARG -- " ;; # wrap make in a watchdog
+ e) LOCK=0 ;; # whether to use flock to protect the build-cycle
f) FORCE_REBUILD=1;; # whether to force an initial rebuild on restart, even if the pull-info are unchanged
+ g) GERRIT_REF="$OPTARG" ; BRANCH="gerrit"; SEND_MAIL="none"; PRIME_BUILD=1 ;; # gerit's ref to fetch. This imply a one time build, no memory
h) usage; exit ;; # display help
i) NICE="$NICE ionice -c3" ;; # be gentle on i/o
k) KEEP_AUTOGEN="YES" ;; # do not override the local autogen.lastrun if present
@@ -326,7 +331,11 @@ else
esac
fi
-collect_current_heads
+if [ -z "$GERRIT_REF" ] ; then
+ collect_current_heads
+else
+ git fetch ssh://gerrit/core $GERRIT_REF && git checkout FETCH_HEAD || die "Error setting up the ref";
+fi
# do a build without involving the tinderbox to establish a good baseline
if [ "${PRIME_BUILD?}" = "1" ] ; then
@@ -344,8 +353,9 @@ if [ "${PRIME_BUILD?}" = "1" ] ; then
do_build
- rotate_logs
-
+ if [ -z "$GERRIT_REF" ] ; then
+ rotate_logs
+ fi
if [ "$retval" = "0" ] ; then
exit 0
else
@@ -354,6 +364,15 @@ if [ "${PRIME_BUILD?}" = "1" ] ; then
) 200>${lock_file?}
retval=$?
+ if [ -n "$GERRIT_REF" ] ; then
+ if [ "${retval}" = "0" ] ; then
+ echo "ssh gerrit gerrit review --project core --force-message -m \"Successful build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified +1 $(git rev-parse HEAD)"
+ ssh gerrit gerrit review --project core --force-message -m \"Successful build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified +1 $(git rev-parse HEAD)
+ else
+ echo "ssh gerrit gerrit review --project core --force-message -m \"Failed build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified -1 $(git rev-parse HEAD)"
+ ssh gerrit gerrit review --project core --force-message -m \"Failed build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified -1 $(git rev-parse HEAD)
+ fi
+ fi
exit ${retval?}
else
if [ ! -f "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt" ] ; then
diff --git a/bin/tinbuild_internals.sh b/bin/tinbuild_internals.sh
index 9f1ff63..97d3589 100644
--- a/bin/tinbuild_internals.sh
+++ b/bin/tinbuild_internals.sh
@@ -435,8 +435,11 @@ do_build()
build_status="build_failed"
retval=0
retry_count=3
- phase_list="autogen clean make test push"
-
+ if [ "$DO_NOT_CLEAN" = "1" ] ; then
+ phase_list="autogen make test push"
+ else
+ phase_list="autogen clean make test push"
+ fi
while [ "$phase_list" != "" ] ; do
for p in $phase_list ; do
[ $V ] && echo "phase $p"