Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Commit

Permalink
Handle Jenkins errors
Browse files Browse the repository at this point in the history
Consider any result coming from Jenkins, except straight SUCCESS or
UNSTABLE (with matching skt results), an error. Ignore builds with such
results, leaving patch tests in "pendingpatches", and baseline untested,
both to be retried later.

UNSTABLE is a Jenkins build result signifying some errors, which were
not fatal for the completion of the build, while FAILURE is a fatal
build error. We can consider "build" to be our test run, and test
failures not fatal for the run. It's awkward naming, but it seems to be
the best mapping to Jenkins build results.

See also http://javadoc.jenkins-ci.org/hudson/model/Result.html
  • Loading branch information
spbnick committed Jul 18, 2018
1 parent a6685d3 commit 2404612
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
4 changes: 4 additions & 0 deletions sktm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ def check_pending(self):
pjt, bid, bres.name, rurl)
self.pj.remove((pjt, bid, cpw))

if bres == sktm.tresult.ERROR:
logging.warning("job completed with an error, ignoring")
continue

if pjt == sktm.jtype.BASELINE:
self.db.update_baseline(
self.baserepo,
Expand Down
32 changes: 18 additions & 14 deletions sktm/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,24 @@ def get_result(self, jobname, buildid):

if bstatus == "SUCCESS":
return sktm.tresult.SUCCESS

# Find earliest (worst) step failure
step_failure_result_list = [
("skt.cmd_merge", sktm.tresult.MERGE_FAILURE),
("skt.cmd_build", sktm.tresult.BUILD_FAILURE),
("skt.cmd_run", sktm.tresult.TEST_FAILURE),
]
for (step, failure_result) in step_failure_result_list:
if set(self.__get_data_list(jobname, buildid, step, "status")) & \
set(["FAILED", "REGRESSION"]):
return failure_result

logging.warning("Unknown status. marking as test failure")
return sktm.tresult.TEST_FAILURE
elif bstatus == "UNSTABLE":
# Find earliest (worst) step failure
step_failure_result_list = [
("skt.cmd_merge", sktm.tresult.MERGE_FAILURE),
("skt.cmd_build", sktm.tresult.BUILD_FAILURE),
("skt.cmd_run", sktm.tresult.TEST_FAILURE),
]
for (step, failure_result) in step_failure_result_list:
if set(self.__get_data_list(jobname, buildid,
step, "status")) & \
set(["FAILED", "REGRESSION"]):
return failure_result
logging.warning("Build status is \"%s\", "
"but no failed steps found, reporting as error",
bstatus)
else:
logging.warning("Reporting build status \"%s\" as error", bstatus)
return sktm.tresult.ERROR

# FIXME Clarify/fix argument names
def build(self, jobname, baserepo=None, ref=None, baseconfig=None,
Expand Down

0 comments on commit 2404612

Please sign in to comment.