diff options
-rw-r--r-- | etc/status/public_html/jquery.zuul.js | 12 | ||||
-rw-r--r-- | requirements.txt | 3 | ||||
-rw-r--r-- | tests/test_model.py | 19 | ||||
-rw-r--r-- | zuul/model.py | 24 | ||||
-rw-r--r-- | zuul/scheduler.py | 9 |
5 files changed, 51 insertions, 16 deletions
diff --git a/etc/status/public_html/jquery.zuul.js b/etc/status/public_html/jquery.zuul.js index c13e48cae..5e442058e 100644 --- a/etc/status/public_html/jquery.zuul.js +++ b/etc/status/public_html/jquery.zuul.js @@ -316,9 +316,11 @@ var $enqueue_time = $('<small />').addClass('time') .attr('title', 'Elapsed Time').html(enqueue_time); - var $right = $('<div />') - .addClass('col-xs-4 text-right') - .append($remaining_time, $('<br />'), $enqueue_time); + var $right = $('<div />'); + if (change.live === true) { + $right.addClass('col-xs-4 text-right') + .append($remaining_time, $('<br />'), $enqueue_time); + } var $header = $('<div />') .addClass('row') @@ -840,7 +842,9 @@ }); $.each(change_queue.heads, function(head_i, head) { $.each(head, function(change_i, change) { - count += 1; + if (change.live === true) { + count += 1; + } var idx = tree.indexOf(change.id); if (idx > -1) { change._tree_index = idx; diff --git a/requirements.txt b/requirements.txt index b24d1710f..f5525b60f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,7 @@ PyYAML>=3.1.0 Paste WebOb>=1.2.3,<1.3 paramiko>=1.8.0 -GitPython>=0.3.2.1 -lockfile>=0.8 +GitPython>=0.3.3 ordereddict python-daemon>=2.0.4 extras diff --git a/tests/test_model.py b/tests/test_model.py index a97f0a073..271161869 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -43,3 +43,22 @@ class TestJob(BaseTestCase): job = model.Job('job') job.copy(self.job) self.assertTrue(job.skip_if_matcher) + + def _assert_job_booleans_are_not_none(self, job): + self.assertIsNotNone(job.voting) + self.assertIsNotNone(job.hold_following_changes) + + def test_job_sets_defaults_for_boolean_attributes(self): + job = model.Job('job') + self._assert_job_booleans_are_not_none(job) + + def test_metajob_does_not_set_defaults_for_boolean_attributes(self): + job = model.Job('^job') + self.assertIsNone(job.voting) + self.assertIsNone(job.hold_following_changes) + + def test_metajob_copy_does_not_set_undefined_boolean_attributes(self): + job = model.Job('job') + metajob = model.Job('^job') + job.copy(metajob) + self._assert_job_booleans_are_not_none(job) diff --git a/zuul/model.py b/zuul/model.py index f530a91f9..8dc28dfbe 100644 --- a/zuul/model.py +++ b/zuul/model.py @@ -452,8 +452,14 @@ class Job(object): self.failure_pattern = None self.success_pattern = None self.parameter_function = None - self.hold_following_changes = False - self.voting = True + # A metajob should only supply values for attributes that have + # been explicitly provided, so avoid setting boolean defaults. + if self.is_metajob: + self.hold_following_changes = None + self.voting = None + else: + self.hold_following_changes = False + self.voting = True self.branches = [] self._branches = [] self.files = [] @@ -467,6 +473,10 @@ class Job(object): def __repr__(self): return '<Job %s>' % (self.name) + @property + def is_metajob(self): + return self.name.startswith('^') + def copy(self, other): if other.failure_message: self.failure_message = other.failure_message @@ -488,8 +498,11 @@ class Job(object): self.skip_if_matcher = other.skip_if_matcher.copy() if other.swift: self.swift.update(other.swift) - self.hold_following_changes = other.hold_following_changes - self.voting = other.voting + # Only non-None values should be copied for boolean attributes. + if other.hold_following_changes is not None: + self.hold_following_changes = other.hold_following_changes + if other.voting is not None: + self.voting = other.voting def changeMatches(self, change): matches_branch = False @@ -1268,8 +1281,7 @@ class Layout(object): if name in self.jobs: return self.jobs[name] job = Job(name) - if name.startswith('^'): - # This is a meta-job + if job.is_metajob: regex = re.compile(name) self.metajobs.append((regex, job)) else: diff --git a/zuul/scheduler.py b/zuul/scheduler.py index 25f819263..131ad62c3 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -1365,10 +1365,11 @@ class BasePipelineManager(object): self.cancelJobs(item) self.dequeueItem(item) self.pipeline.setDequeuedNeedingChange(item) - try: - self.reportItem(item) - except MergeFailure: - pass + if item.live: + try: + self.reportItem(item) + except MergeFailure: + pass return (True, nnfi, ready_ahead) dep_items = self.getFailingDependentItems(item) actionable = change_queue.isActionable(item) |