Merge "Re-enable TestScheduler.test_rerun_on_error" into feature/zuulv3
diff --git a/README.rst b/README.rst
index 4a3376e..697d994 100644
--- a/README.rst
+++ b/README.rst
@@ -86,9 +86,7 @@
    trying to coordinate and prioritize work) know what you would like
    to work on.
 
-7) TODOv3(jeblair): Coming soon: check storyboard for status of
-   current work items.  We do not have a list of work items yet, but
-   we will soon.
+7) Check storyboard for status of current work items: https://storyboard.openstack.org/#!/board/41
 
 Once you are up to speed on those items, it will be helpful to know
 the following:
@@ -100,9 +98,9 @@
   from something simple such as a test-framework method changing its
   name, to more substantial issues, such as a feature being removed as
   part of the v3 work.  Each test will need to be evaluated
-  individually.  Feel free to, at any time, claim a test name on this
-  etherpad and work on re-enabling it:
-  https://etherpad.openstack.org/p/zuulv3
+  individually.  Feel free to, at any time, claim a test name in this
+  story and work on re-enabling it:
+  https://storyboard.openstack.org/#!/story/2000773
 
 * Because of the importance of external systems, as well as the number
   of internal Zuul components, actually running Zuul in a development
@@ -127,3 +125,20 @@
   simply reflect who to ask to explain the item in more detail if it
   is too cryptic.  In your own work, feel free to leave TODOv3 notes
   if a change would otherwise become too large or unweildy.
+
+Roadmap
+-------
+
+* Implement Zookeeper for Nodepool builders and begin using this in
+  OpenStack Infra
+* Implement Zookeeper for Nodepool launchers
+* Implement a shim to translate Zuul v2 demand into Nodepool Zookeeper
+  launcher requests
+* Begin using Zookeeper based Nodepool launchers with Zuul v2.5 in
+  OpenStack Infra
+* Begin using Zuul v3 to run jobs for Zuul itself
+* Move OpenStack Infra to use Zuul v3
+* Implement Github support
+* Begin using Zuul v3 to run tests on Ansible repos
+* Implement support in Nodepool for non-OpenStack clouds
+* Add native container support to Zuul / Nodepool
diff --git a/tests/fixtures/config/single-tenant/git/layout-inheritance/zuul.yaml b/tests/fixtures/config/single-tenant/git/layout-inheritance/zuul.yaml
new file mode 100644
index 0000000..3070af0
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-inheritance/zuul.yaml
@@ -0,0 +1,46 @@
+- pipeline:
+    name: check
+    manager: independent
+    source:
+      gerrit
+    trigger:
+      gerrit:
+        - event: patchset-created
+    success:
+      gerrit:
+        verified: 1
+    failure:
+      gerrit:
+        verified: -1
+
+
+- job:
+    name: project-test-irrelevant-starts-empty
+
+- job:
+    name: project-test-irrelevant-starts-full
+    irrelevant-files:
+      - ^README$
+      - ^ignoreme$
+
+- job:
+    name: project-test-nomatch-starts-empty
+
+- job:
+    name: project-test-nomatch-starts-full
+    irrelevant-files:
+      - ^README$
+
+- project:
+    name: org/project
+    check:
+      jobs:
+        - project-test-irrelevant-starts-empty:
+            irrelevant-files:
+              - ^README$
+              - ^ignoreme$
+        - project-test-irrelevant-starts-full
+        - project-test-nomatch-starts-empty:
+            irrelevant-files:
+              - ^README$
+        - project-test-nomatch-starts-full
diff --git a/tests/fixtures/config/templated-project/git/common-config/zuul.yaml b/tests/fixtures/config/templated-project/git/common-config/zuul.yaml
index b4773f1..22a2d6d 100644
--- a/tests/fixtures/config/templated-project/git/common-config/zuul.yaml
+++ b/tests/fixtures/config/templated-project/git/common-config/zuul.yaml
@@ -81,6 +81,9 @@
 - job:
     name: layered-project-foo-test5
 
+- job:
+    name: project-test6
+
 - project:
     name: org/templated-project
     templates:
diff --git a/tests/test_model.py b/tests/test_model.py
index 0d4c7b6..0189340 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -265,6 +265,51 @@
         self.assertEqual(job.name, 'python27')
         self.assertEqual(job.timeout, 70)
 
+    def test_inheritance_keeps_matchers(self):
+        layout = model.Layout()
+
+        pipeline = model.Pipeline('gate', layout)
+        layout.addPipeline(pipeline)
+        queue = model.ChangeQueue(pipeline)
+        project = model.Project('project')
+
+        base = configloader.JobParser.fromYaml(layout, {
+            '_source_project': project,
+            'name': 'base',
+            'timeout': 30,
+        })
+        layout.addJob(base)
+        python27 = configloader.JobParser.fromYaml(layout, {
+            '_source_project': project,
+            'name': 'python27',
+            'parent': 'base',
+            'timeout': 40,
+            'irrelevant-files': ['^ignored-file$'],
+        })
+        layout.addJob(python27)
+
+        project_config = configloader.ProjectParser.fromYaml(layout, {
+            'name': 'project',
+            'gate': {
+                'jobs': [
+                    'python27',
+                ]
+            }
+        })
+        layout.addProjectConfig(project_config, update_pipeline=False)
+
+        change = model.Change(project)
+        change.branch = 'master'
+        change.files = ['/COMMIT_MSG', 'ignored-file']
+        item = queue.enqueueChange(change)
+        item.current_build_set.layout = layout
+
+        self.assertTrue(base.changeMatches(change))
+        self.assertFalse(python27.changeMatches(change))
+
+        item.freezeJobTree()
+        self.assertEqual([], item.getJobs())
+
     def test_job_source_project(self):
         layout = model.Layout()
         base_project = model.Project('base_project')
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index a9fc5d4..5f41c5d 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -2236,6 +2236,24 @@
     def test_irrelevant_files_no_match_runs_job(self):
         self._test_irrelevant_files_jobs(should_skip=False)
 
+    def test_inherited_jobs_keep_matchers(self):
+        self.updateConfigLayout('layout-inheritance')
+        self.sched.reconfigure(self.config)
+
+        files = {'ignoreme': 'ignored\n'}
+
+        change = self.fake_gerrit.addFakeChange('org/project',
+                                                'master',
+                                                'test irrelevant-files',
+                                                files=files)
+        self.fake_gerrit.addEvent(change.getPatchsetCreatedEvent(1))
+        self.waitUntilSettled()
+
+        run_jobs = set([build.name for build in self.history])
+
+        self.assertEqual(set(['project-test-nomatch-starts-empty',
+                              'project-test-nomatch-starts-full']), run_jobs)
+
     @skip("Disabled for early v3 development")
     def test_test_config(self):
         "Test that we can test the config"
diff --git a/zuul/model.py b/zuul/model.py
index 06639f1..a77183c 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -1771,6 +1771,11 @@
                     if variant not in inherited:
                         frozen_job.inheritFrom(variant)
                         inherited.add(variant)
+            if not inherited:
+                # A change must match at least one defined job variant
+                # (that is to say that it must match more than just
+                # the job that is defined in the tree).
+                continue
             if job not in inherited:
                 # Only update from the job in the tree if it is
                 # unique, otherwise we might unset an attribute we