Merge "implement gerrit pagination in simplequery"
diff --git a/README.rst b/README.rst
index 1b227e7..ff4d938 100644
--- a/README.rst
+++ b/README.rst
@@ -9,7 +9,7 @@
To browse the latest code, see: https://git.openstack.org/cgit/openstack-infra/zuul/tree/
To clone the latest code, use `git clone git://git.openstack.org/openstack-infra/zuul`
-Bugs are handled at: https://launchpad.net/zuul
+Bugs are handled at: https://storyboard.openstack.org/#!/project/679
Code reviews are, as you might expect, handled by gerrit. The gerrit they
use is http://review.openstack.org
diff --git a/requirements.txt b/requirements.txt
index 50726c0..dd947d6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,7 +5,7 @@
Paste
WebOb>=1.2.3,<1.3
paramiko>=1.8.0
-GitPython>=0.3.2.RC1
+GitPython==0.3.2.RC1
lockfile>=0.8
ordereddict
python-daemon
diff --git a/tests/fixtures/layouts/bad_misplaced_ref.yaml b/tests/fixtures/layouts/bad_misplaced_ref.yaml
new file mode 100644
index 0000000..f009c39
--- /dev/null
+++ b/tests/fixtures/layouts/bad_misplaced_ref.yaml
@@ -0,0 +1,13 @@
+pipelines:
+ - name: 'check'
+ manager: IndependentPipelineManager
+ trigger:
+ gerrit:
+ - event: patchset-created
+ ref: /some/ref/path
+
+projects:
+ - name: org/project
+ merge-mode: cherry-pick
+ check:
+ - project-check
diff --git a/zuul/layoutvalidator.py b/zuul/layoutvalidator.py
index 9a4e00f..6969653 100644
--- a/zuul/layoutvalidator.py
+++ b/zuul/layoutvalidator.py
@@ -18,6 +18,7 @@
import voluptuous as v
import string
+from zuul.trigger import gerrit
# Several forms accept either a single item or a list, this makes
# specifying that in the schema easy (and explicit).
@@ -271,3 +272,7 @@
if 'project-templates' in data:
self.checkDuplicateNames(
data['project-templates'], ['project-templates'])
+ for pipeline in data['pipelines']:
+ if 'gerrit' in pipeline['trigger']:
+ gerrit.validate_trigger(pipeline['trigger'])
+
diff --git a/zuul/model.py b/zuul/model.py
index b03bbb0..67ce8be 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -709,6 +709,10 @@
ret['project'] = changeish.project.name
ret['enqueue_time'] = int(self.enqueue_time * 1000)
ret['jobs'] = []
+ if hasattr(changeish, 'owner'):
+ ret['owner'] = changeish.owner
+ else:
+ ret['owner'] = None
max_remaining = 0
for job in self.pipeline.getJobs(changeish):
now = time.time()
@@ -857,6 +861,7 @@
self.approvals = []
self.open = None
self.status = None
+ self.owner = None
def _id(self):
return '%s,%s' % (self.number, self.patchset)
diff --git a/zuul/trigger/gerrit.py b/zuul/trigger/gerrit.py
index f67a275..0c0a376 100644
--- a/zuul/trigger/gerrit.py
+++ b/zuul/trigger/gerrit.py
@@ -16,6 +16,7 @@
import threading
import time
import urllib2
+import voluptuous
from zuul.lib import gerrit
from zuul.model import TriggerEvent, Change, Ref, NullChange
@@ -371,6 +372,7 @@
change.approvals = data['currentPatchSet'].get('approvals', [])
change.open = data['open']
change.status = data['status']
+ change.owner = data['owner']
if change.is_merged:
# This change is merged, so we don't need to look any further
@@ -411,3 +413,14 @@
if sha:
url += ';a=commitdiff;h=' + sha
return url
+
+
+def validate_trigger(trigger_data):
+ """Validates the layout's trigger data."""
+ events_with_ref = ('ref-updated', )
+ for event in trigger_data['gerrit']:
+ if event['event'] not in events_with_ref and event.get('ref', False):
+ raise voluptuous.Invalid(
+ "The event %s does not include ref information, Zuul cannot "
+ "use ref filter 'ref: %s'" % (event['event'], event['ref']))
+