Merge "Remove extra debugging around git repo leaks" into feature/zuulv3
diff --git a/requirements.txt b/requirements.txt
index 84d84be..186e7f6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,7 +4,7 @@
 Paste
 WebOb>=1.2.3
 paramiko>=1.8.0,<2.0.0
-GitPython>=0.3.3
+GitPython>=0.3.3,<2.1.2
 ordereddict
 python-daemon>=2.0.4,<2.1.0
 extras
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml
new file mode 100644
index 0000000..f679dce
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+  tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml
new file mode 100644
index 0000000..f679dce
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+  tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml
new file mode 100644
index 0000000..f679dce
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+  tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml
new file mode 100644
index 0000000..f679dce
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+  tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml
new file mode 100644
index 0000000..c921c90
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml
@@ -0,0 +1,52 @@
+- pipeline:
+    name: check
+    manager: independent
+    source:
+      gerrit
+    trigger:
+      gerrit:
+        - event: patchset-created
+    success:
+      gerrit:
+        verified: 1
+    failure:
+      gerrit:
+        verified: -1
+
+- job:
+    name: merge
+    failure-message: Unable to merge change
+    hold-following-changes: true
+    tags:
+      - merge
+
+- job:
+    name: test1
+
+- job:
+    name: test2
+
+- job:
+    name: integration
+
+- project:
+    name: org/project1
+    check:
+      jobs:
+        - merge:
+            jobs:
+              - test1
+              - test2
+              - integration
+            tags:
+              - extratag
+
+- project:
+    name: org/project2
+    check:
+      jobs:
+        - merge:
+            jobs:
+              - test1
+              - test2
+              - integration
diff --git a/tests/fixtures/layout-tags.yaml b/tests/fixtures/layout-tags.yaml
deleted file mode 100644
index d5b8bf9..0000000
--- a/tests/fixtures/layout-tags.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-includes:
-  - python-file: tags_custom_functions.py
-
-pipelines:
-  - name: check
-    manager: IndependentPipelineManager
-    trigger:
-      gerrit:
-        - event: patchset-created
-    success:
-      gerrit:
-        verified: 1
-    failure:
-      gerrit:
-        verified: -1
-
-jobs:
-  - name: ^.*$
-    parameter-function: apply_tags
-  - name: ^.*-merge$
-    failure-message: Unable to merge change
-    hold-following-changes: true
-    tags: merge
-  - name: project1-merge
-    tags:
-      - project1
-      - extratag
-
-projects:
-  - name: org/project1
-    check:
-      - project1-merge:
-        - project1-test1
-        - project1-test2
-        - project1-project2-integration
-
-  - name: org/project2
-    check:
-      - project2-merge:
-        - project2-test1
-        - project2-test2
-        - project1-project2-integration
diff --git a/tests/fixtures/tags_custom_functions.py b/tests/fixtures/tags_custom_functions.py
deleted file mode 100644
index 67e7ef1..0000000
--- a/tests/fixtures/tags_custom_functions.py
+++ /dev/null
@@ -1,2 +0,0 @@
-def apply_tags(item, job, params):
-    params['BUILD_TAGS'] = ' '.join(sorted(job.tags))
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 02e648e..1e56fae 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -2753,11 +2753,9 @@
         self.assertEqual(B.data['status'], 'MERGED')
         self.assertEqual(B.reported, 2)
 
-    @skip("Disabled for early v3 development")
     def test_tags(self):
         "Test job tags"
-        self.config.set('zuul', 'layout_config',
-                        'tests/fixtures/layout-tags.yaml')
+        self.updateConfigLayout('layout-tags')
         self.sched.reconfigure(self.config)
 
         A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
@@ -2766,12 +2764,16 @@
         self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
         self.waitUntilSettled()
 
-        results = {'project1-merge': 'extratag merge project1',
-                   'project2-merge': 'merge'}
+        self.assertEqual(len(self.history), 8)
+
+        results = {self.getJobFromHistory('merge',
+                   project='org/project1').uuid: 'extratag merge',
+                   self.getJobFromHistory('merge',
+                   project='org/project2').uuid: 'merge'}
 
         for build in self.history:
-            self.assertEqual(results.get(build.name, ''),
-                             build.parameters.get('BUILD_TAGS'))
+            self.assertEqual(results.get(build.uuid, ''),
+                             build.parameters['vars']['zuul'].get('tags'))
 
     def test_timer(self):
         "Test that a periodic job is triggered"
diff --git a/zuul/launcher/client.py b/zuul/launcher/client.py
index 63c9c86..52e4397 100644
--- a/zuul/launcher/client.py
+++ b/zuul/launcher/client.py
@@ -225,7 +225,9 @@
         zuul_params = dict(uuid=uuid,
                            pipeline=pipeline.name,
                            job=job.name,
-                           project=item.change.project.name)
+                           project=item.change.project.name,
+                           tags=' '.join(sorted(job.tags)))
+
         if hasattr(item.change, 'branch'):
             zuul_params['branch'] = item.change.branch
         if hasattr(item.change, 'number'):