diff --git a/buildman/component/buildcomponent.py b/buildman/component/buildcomponent.py index fb81e6aa5..391f8ffed 100644 --- a/buildman/component/buildcomponent.py +++ b/buildman/component/buildcomponent.py @@ -67,7 +67,7 @@ class BuildComponent(BaseComponent): def start_build(self, build_job): """ Starts a build. """ self._current_job = build_job - self._build_status = StatusHandler(self.build_logs, build_job.repo_build) + self._build_status = StatusHandler(self.build_logs, build_job.repo_build.uuid) self._image_info = {} self._set_status(ComponentStatus.BUILDING) diff --git a/buildman/jobutil/buildstatus.py b/buildman/jobutil/buildstatus.py index 68b8cd5e3..b79776c46 100644 --- a/buildman/jobutil/buildstatus.py +++ b/buildman/jobutil/buildstatus.py @@ -1,12 +1,12 @@ from data.database import BUILD_PHASE +from data import model class StatusHandler(object): """ Context wrapper for writing status to build logs. """ - def __init__(self, build_logs, repository_build): + def __init__(self, build_logs, repository_build_uuid): self._current_phase = None - self._repository_build = repository_build - self._uuid = repository_build.uuid + self._uuid = repository_build_uuid self._build_logs = build_logs self._status = { @@ -41,8 +41,11 @@ class StatusHandler(object): self._current_phase = phase self._append_log_message(phase, self._build_logs.PHASE, extra_data) - self._repository_build.phase = phase - self._repository_build.save() + + # Update the repository build with the new phase + repo_build = model.get_repository_build(self._uuid) + repo_build.phase = phase + repo_build.save() return True def __enter__(self):