Skip to content

Commit

Permalink
build: populate .task_id for container CG builds
Browse files Browse the repository at this point in the history
CG builds do not have a way to link back to a Koji task.

All container builds in Koji have "task_id: None". The content generator
uploads the Koji task ID within a separate attribute,
"container_koji_task_id".

Add a helper method so we can access this value seamlessly with the
.task_id property.
  • Loading branch information
ktdreyer committed Aug 2, 2018
1 parent aa650a9 commit 93f8054
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions txkoji/build.py
Expand Up @@ -86,3 +86,16 @@ def estimate_completion(self):
avg_delta = yield self.connection.getAverageBuildDuration(self.name)
est_completion = self.started + avg_delta
defer.returnValue(est_completion)

@property
def task_id(self):
"""
Hack to return a task ID for a build, including container CG builds.
We have something for this in Brewweb, but not yet for upstream Koji:
https://pagure.io/koji/issue/215
"""
if self['task_id']:
return self['task_id']
if self.extra and 'container_koji_task_id' in self.extra:
return self.extra['container_koji_task_id']

0 comments on commit 93f8054

Please sign in to comment.