Merge "Case sensitive label matching"
diff --git a/.zuul.yaml b/.zuul.yaml
new file mode 100644
index 0000000..9f0382b
--- /dev/null
+++ b/.zuul.yaml
@@ -0,0 +1,14 @@
+- project:
+ name: openstack-infra/zuul
+ check:
+ jobs:
+ - tox-docs
+ - tox-cover:
+ voting: false
+ - tox-pep8
+ - tox-py27
+ gate:
+ jobs:
+ - tox-docs
+ - tox-pep8
+ - tox-py27
diff --git a/doc/source/connections.rst b/doc/source/connections.rst
index 298100a..34b8f94 100644
--- a/doc/source/connections.rst
+++ b/doc/source/connections.rst
@@ -42,6 +42,13 @@
Optional: Keepalive timeout, 0 means no keepalive.
``keepalive=60``
+**strip_branch_ref**
+ Optional: Earlier versions of Gerrit reported branch refs in the
+ form "master" and later forms as "refs/heads/master". Set this to 1
+ to enable compatibility with the earlier form by stripping the
+ "refs/heads/" portion of the ref.
+ ``strip_branch_ref=1``
+
Gerrit Configuration
~~~~~~~~~~~~~~~~~~~~
diff --git a/etc/status/public_html/jquery.zuul.js b/etc/status/public_html/jquery.zuul.js
index d973948..d0a200b 100644
--- a/etc/status/public_html/jquery.zuul.js
+++ b/etc/status/public_html/jquery.zuul.js
@@ -542,6 +542,11 @@
// Toggle showing/hiding the patchset when the header is
// clicked.
+ if (e.target.nodeName.toLowerCase() === 'a') {
+ // Ignore clicks from gerrit patch set link
+ return;
+ }
+
// Grab the patchset panel
var $panel = $(e.target).parents('.zuul-change');
var $body = $panel.children('.zuul-patchset-body');
@@ -625,7 +630,7 @@
setTimeout(function() {app.schedule(app);}, 5000);
return;
}
- app.update().complete(function () {
+ app.update().always(function () {
setTimeout(function() {app.schedule(app);}, 5000);
});
@@ -695,7 +700,7 @@
.removeClass('zuul-msg-wrap-off')
.show();
})
- .complete(function () {
+ .always(function () {
xhr = undefined;
app.emit('update-end');
});
diff --git a/zuul/connection/gerrit.py b/zuul/connection/gerrit.py
index f3a6859..a5b0e25 100644
--- a/zuul/connection/gerrit.py
+++ b/zuul/connection/gerrit.py
@@ -75,6 +75,9 @@
if refupdate:
event.project_name = refupdate.get('project')
event.ref = refupdate.get('refName')
+ if (self.connection.strip_branch_ref and
+ event.ref.startswith('refs/heads/')):
+ event.ref = event.ref[len('refs/heads/'):]
event.oldrev = refupdate.get('oldRev')
event.newrev = refupdate.get('newRev')
# Map the event types to a field name holding a Gerrit
@@ -231,6 +234,8 @@
self.port = int(self.connection_config.get('port', 29418))
self.keyfile = self.connection_config.get('sshkey', None)
self.keepalive = int(self.connection_config.get('keepalive', 60))
+ self.strip_branch_ref = bool(self.connection_config.get(
+ 'strip_branch_ref'))
self.watcher_thread = None
self.event_queue = None
self.client = None
@@ -281,7 +286,7 @@
if val is True:
cmd += ' --%s' % key
else:
- cmd += ' --%s %s' % (key, val)
+ cmd += ' --label %s=%s' % (key, val)
cmd += ' %s' % change
out, err = self._ssh(cmd)
return err