Minutes of ESC call: 2015-04-02
Miklos Vajna
vmiklos at collabora.co.uk
Tue Apr 7 01:31:17 PDT 2015
On Fri, Apr 03, 2015 at 06:51:32PM +0200, Jan Holesovsky <kendy at collabora.com> wrote:
> + would be good to have 10% as the goal for Linux (Bjoern)
> + that is achievable if people test their commits (Norbert)
I'm attaching two scripts I'm using for a while now, git-breview (as in
git build-check-review) is a wrapper around git-review that also does a
+2 on your change, indicating that you're only submitting the change to
gerrit for build verification. (Ideally sooner or later doing the same
with a simple 'git push' will be possible after tweaking .git/config,
but that's not the case for our gerrit instance ATM.) So you don't have
to go to the web interface and code-review+2 your change manually.
The other one is gerrit-autosubmit that you can run in the root of your
master checkout, it listens on the gerrit event stream and in case your
change gets a verified+1 label, then it submits to the change to master.
So you don't have to wait for the jenkins feedback, if the result is
success, it'll instantly go to master. (I *think* ideally jenkins could
do this itself.)
If others find these scripts useful, then maybe they should be placed in
dev-tools.git.
Just my two cents on making build-verify-on-gerrit a bit less painful
compared to direct pushing to master. :-)
Regards,
Miklos
-------------- next part --------------
#!/usr/bin/python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
import json
import os
import subprocess
def get_config(key):
sock = subprocess.Popen(["git", "config", "-f", ".gitreview", key], stdout=subprocess.PIPE)
ret = sock.stdout.readline().strip()
sock.stdout.close()
return ret
server = get_config("gerrit.host")
project = get_config("gerrit.project")
branch = get_config("gerrit.defaultbranch")
sock = subprocess.Popen(["ssh", server, "gerrit", "stream-events"], stdout=subprocess.PIPE, bufsize=1)
for line in iter(sock.stdout.readline, b''):
event = json.loads(line)
if event['type'] != "comment-added":
continue
if event['change']['owner']['username'] != os.environ['USER']:
continue
if event['change']['project'] != project:
continue
if event['change']['branch'] != branch:
continue
if 'approvals' not in event.keys():
continue
if len([approval for approval in event['approvals'] if approval['type'] == "Verified" and approval['value'] == "1"]) != 1:
continue
rev = event['patchSet']['revision']
cmd = "ssh " + server + " gerrit review -s " + rev
print(cmd)
os.system(cmd)
sock.communicate()
# vim:set shiftwidth=4 softtabstop=4 expandtab:
-------------- next part --------------
#!/usr/bin/env bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
if git-review; then
rev=$(git rev-parse HEAD)
host=$(git config -f .gitreview gerrit.host)
ssh $host gerrit review --code-review=2 $rev
fi
# vim:set shiftwidth=4 softtabstop=4 expandtab:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150407/2202a2d2/attachment.sig>
More information about the LibreOffice
mailing list