Browse Source

web: remove build and job_name filter from the buildset route

This change fixes the buildset route limit which incorrectly match
the number of build instead of the number of buildset.

Change-Id: Ia5775a32e646a7107a6dd04328ac36ec681b3b50
Tristan Cacqueray 2 months ago
parent
commit
5c342421f1
3 changed files with 3 additions and 11 deletions
  1. 0
    1
      tests/unit/test_web.py
  2. 1
    5
      zuul/driver/sql/sqlconnection.py
  3. 2
    5
      zuul/web/__init__.py

+ 0
- 1
tests/unit/test_web.py View File

@@ -725,7 +725,6 @@ class TestBuildInfo(ZuulDBTestCase, BaseTestWeb):
725 725
 
726 726
         buildsets = self.get_url("api/tenant/tenant-one/buildsets").json()
727 727
         self.assertEqual(2, len(buildsets))
728
-        self.assertEqual(3, len(buildsets[0]["builds"]))
729 728
 
730 729
 
731 730
 class TestArtifacts(ZuulDBTestCase, BaseTestWeb, AnsibleZuulTestCase):

+ 1
- 5
zuul/driver/sql/sqlconnection.py View File

@@ -107,15 +107,12 @@ class DatabaseSession(object):
107 107
 
108 108
     def getBuildsets(self, tenant=None, project=None, pipeline=None,
109 109
                      change=None, branch=None, patchset=None, ref=None,
110
-                     newrev=None, uuid=None, job_name=None, result=None,
110
+                     newrev=None, uuid=None, result=None,
111 111
                      limit=50, offset=0):
112 112
 
113
-        build_table = self.connection.zuul_build_table
114 113
         buildset_table = self.connection.zuul_buildset_table
115 114
 
116 115
         q = self.session().query(self.connection.buildSetModel).\
117
-            join(self.connection.buildModel).\
118
-            options(orm.contains_eager(self.connection.buildSetModel.builds)).\
119 116
             with_hint(buildset_table, 'USE INDEX (PRIMARY)', 'mysql')
120 117
 
121 118
         q = self.listFilter(q, buildset_table.c.tenant, tenant)
@@ -128,7 +125,6 @@ class DatabaseSession(object):
128 125
         q = self.listFilter(q, buildset_table.c.newrev, newrev)
129 126
         q = self.listFilter(q, buildset_table.c.uuid, uuid)
130 127
         q = self.listFilter(q, buildset_table.c.result, result)
131
-        q = self.listFilter(q, build_table.c.job_name, job_name)
132 128
 
133 129
         q = q.order_by(buildset_table.c.id.desc()).\
134 130
             limit(limit).\

+ 2
- 5
zuul/web/__init__.py View File

@@ -515,10 +515,7 @@ class ZuulWebAPI(object):
515 515
             'ref': buildset.ref,
516 516
             'newrev': buildset.newrev,
517 517
             'ref_url': buildset.ref_url,
518
-            'builds': []
519 518
         }
520
-        for build in buildset.builds:
521
-            ret["builds"].append(self.buildToDict(build))
522 519
         return ret
523 520
 
524 521
     @cherrypy.expose
@@ -526,13 +523,13 @@ class ZuulWebAPI(object):
526 523
     @cherrypy.tools.json_out(content_type='application/json; charset=utf-8')
527 524
     def buildsets(self, tenant, project=None, pipeline=None, change=None,
528 525
                   branch=None, patchset=None, ref=None, newrev=None,
529
-                  uuid=None, job_name=None, result=None, limit=50, skip=0):
526
+                  uuid=None, result=None, limit=50, skip=0):
530 527
         connection = self._get_connection(tenant)
531 528
 
532 529
         buildsets = connection.getBuildsets(
533 530
             tenant=tenant, project=project, pipeline=pipeline, change=change,
534 531
             branch=branch, patchset=patchset, ref=ref, newrev=newrev,
535
-            uuid=uuid, job_name=job_name, result=result,
532
+            uuid=uuid, result=result,
536 533
             limit=limit, offset=skip)
537 534
 
538 535
         resp = cherrypy.response

Loading…
Cancel
Save