summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/fixtures/config/single-tenant/git/common-config/zuul.yaml2
-rwxr-xr-xtests/unit/test_web.py11
-rw-r--r--zuul/rpclistener.py5
3 files changed, 18 insertions, 0 deletions
diff --git a/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml b/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
index c9a4b970e..c71e4bda8 100644
--- a/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
+++ b/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
@@ -74,6 +74,8 @@
- job:
name: project-post
+ tags:
+ - post
nodeset:
nodes:
- name: static
diff --git a/tests/unit/test_web.py b/tests/unit/test_web.py
index 30eba3b59..7fb8fe495 100755
--- a/tests/unit/test_web.py
+++ b/tests/unit/test_web.py
@@ -695,6 +695,17 @@ class TestWeb(BaseTestWeb):
variants = [{'parent': 'base'}]
self.assertEqual(variants, job.get('variants'))
+ def test_jobs_list_tags(self):
+ resp = self.get_url("api/tenant/tenant-one/jobs").json()
+
+ post_job = None
+ for job in resp:
+ if job['name'] == 'project-post':
+ post_job = job
+ break
+ self.assertIsNotNone(post_job)
+ self.assertEqual(['post'], post_job.get('tags'))
+
def test_web_job_noop(self):
job = self.get_url("api/tenant/tenant-one/job/noop").json()
self.assertEqual("noop", job[0]["name"])
diff --git a/zuul/rpclistener.py b/zuul/rpclistener.py
index 7b9dd9b04..4c384352b 100644
--- a/zuul/rpclistener.py
+++ b/zuul/rpclistener.py
@@ -368,10 +368,13 @@ class RPCListener(object):
job.sendWorkComplete(json.dumps(None))
for job_name in sorted(tenant.layout.jobs):
desc = None
+ tags = set()
variants = []
for variant in tenant.layout.jobs[job_name]:
if not desc and variant.description:
desc = variant.description.split('\n')[0]
+ if variant.tags:
+ tags.update(list(variant.tags))
job_variant = {}
if not variant.isBase():
if variant.parent:
@@ -391,6 +394,8 @@ class RPCListener(object):
job_output["description"] = desc
if variants:
job_output["variants"] = variants
+ if tags:
+ job_output["tags"] = list(tags)
output.append(job_output)
job.sendWorkComplete(json.dumps(output))