reporter: do not expect branch attribute in Tag object

This change fixes reporting of Tag event where the branch attribute was
expected:

File "zuul/scheduler.py", line 383, in onBuildCompleted
    branchname = (build.build_set.item.change.branch.
AttributeError: 'Tag' object has no attribute 'branch'

File "zuul/driver/sql/sqlreporter.py", line 55, in report
    branch=item.change.branch,
AttributeError: 'Tag' object has no attribute 'branch'

Change-Id: I5dbe4663c4d1e341b08a32eedbbcfb775330e881
This commit is contained in:
Tristan Cacqueray
2018-04-12 01:08:26 +00:00
committed by Tobias Henkel
parent 7b7a9231b5
commit 5bc269e5f3
5 changed files with 53 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ class SQLReporter(BaseReporter):
ref = getattr(item.change, 'ref', '')
oldrev = getattr(item.change, 'oldrev', '')
newrev = getattr(item.change, 'newrev', '')
branch = getattr(item.change, 'branch', '')
buildset_ins = self.connection.zuul_buildset_table.insert().values(
zuul_ref=item.current_build_set.ref,
pipeline=item.pipeline.name,
@@ -52,7 +53,7 @@ class SQLReporter(BaseReporter):
message=self._formatItemReport(
item, with_jobs=False),
tenant=item.pipeline.layout.tenant.name,
branch=item.change.branch,
branch=branch,
)
buildset_ins_result = conn.execute(buildset_ins)
build_inserts = []