From 406aee55972ccbce6a1ebc5788e817c9ecf60e9b Mon Sep 17 00:00:00 2001 From: Simon Westphahl Date: Mon, 5 Sep 2022 15:32:53 +0200 Subject: Don't try to report build w/o buildset to DB When a build result arrives for a non-current buildset we should skip the reporting as we can no longer create the reference to the buildset. Traceback (most recent call last): File "/opt/zuul/lib/python3.10/site-packages/zuul/scheduler.py", line 2654, in _doBuildCompletedEvent self.sql.reportBuildEnd( File "/opt/zuul/lib/python3.10/site-packages/zuul/driver/sql/sqlreporter.py", line 143, in reportBuildEnd db_build = self._createBuild(db, build) File "/opt/zuul/lib/python3.10/site-packages/zuul/driver/sql/sqlreporter.py", line 180, in _createBuild tenant=buildset.item.pipeline.tenant.name, uuid=buildset.uuid) AttributeError: 'NoneType' object has no attribute 'item' Change-Id: Iccbe9ab8212fbbfa21cb29b84a17e03ca221d7bd --- zuul/driver/sql/sqlreporter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zuul/driver/sql/sqlreporter.py b/zuul/driver/sql/sqlreporter.py index cf75a7495..d16f50fcb 100644 --- a/zuul/driver/sql/sqlreporter.py +++ b/zuul/driver/sql/sqlreporter.py @@ -176,6 +176,8 @@ class SQLReporter(BaseReporter): start = datetime.datetime.fromtimestamp(start_time, tz=datetime.timezone.utc) buildset = build.build_set + if not buildset: + return db_buildset = db.getBuildset( tenant=buildset.item.pipeline.tenant.name, uuid=buildset.uuid) if not db_buildset: -- cgit v1.2.1