Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 173c7a1

Browse files
authored
Handle buildcomponent's job being None (quay#465)
1 parent 711052d commit 173c7a1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

buildman/component/buildcomponent.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,14 @@ def _build_status_failure(self, exception=None):
451451
Calls self._build_finished with ERROR _without_ logging the failed build.
452452
This allows to handle Redis failures.
453453
"""
454-
build_id = self._current_job.repo_build.uuid
454+
if self._current_job is not None:
455+
build_id = self._current_job.repo_build.uuid
456+
457+
# The build's phase should still be updated even without logging to avoid getting into
458+
# a weird state where it was complete but wasn't updated from "building" because of
459+
# Redis going down.
460+
build_model.update_phase_then_close(build_id, BUILD_PHASE.INTERNAL_ERROR)
455461

456-
# The build's phase should still be updated even without logging to avoid getting into
457-
# a weird state where it was complete but wasn't updated from "building" because of
458-
# Redis going down.
459-
build_model.update_phase_then_close(build_id, BUILD_PHASE.INTERNAL_ERROR)
460462
yield From(self._build_finished(BuildJobResult.ERROR))
461463

462464
@trollius.coroutine

buildman/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ def _job_heartbeat(self, build_job):
177177

178178
@trollius.coroutine
179179
def _job_complete(self, build_job, job_status, executor_name=None, update_phase=False):
180+
if build_job is None:
181+
logger.warning("[BUILD INCOMPLETE: job complete] Build component job is None",)
182+
raise Return()
183+
180184
if update_phase:
181185
try:
182186
status_handler = StatusHandler(self._build_logs, build_job.repo_build.uuid)

0 commit comments

Comments
 (0)