Closed Bug 985068 Opened 8 years ago Closed 1 year ago

add failure_config parameter to mozharness's run_command()


(Release Engineering :: Applications: MozharnessCore, defect)

Not set


(Not tracked)



(Reporter: jlund, Assigned: jlund)


(Whiteboard: [mozharness])

by default, run_command will return the exit code of command. Also, if it's not in success_codes (defaulted to just 0), it will also report an error via self.error(). This just sets the log line to be ERROR but will have no effect on the return_code of the script (the status/result)

If you wish to set result/status of the script run based upon run_command()s exit statuses, you must grab the return code of run_command and change self.return_code directly or use something like self.add_failure()

it may be nice to add something like error_on_failure to run_command() (in addition to the existing halt_on_failure). If True, and the cmd returns an error exit code, it could call self.add_failure(cmd) in self.run_command and allow the script to continue but reporting an error at the end.

We may want something like warn_on_failure too but I am not exactly sure how we report a job as a warning at the end; my understanding is that add_failure() increments self.return_code by 1 so if self.return_code is not 0 at the end, the script run is a failure/error. I need to look at the internals more to figure out how to signal a script run as warning.

This is outside of tbpl/buildbot logic. I think for tbpl/buildbot, we either have to explicitly set self.worst_tbpl_level and add things like self.buildbot_status() and these values might not have a 1-1 mapping with mozharness log levels / self.return_code values. They could also be non-applicable depending on optional steps/actions in mozharness. Because of this, they are treated separately.
Maybe allow this to be a string or dict instead of a bool, to customize how add_failure() is called?
(In reply to Aki Sasaki [:aki] from comment #1)
> Maybe allow this to be a string or dict instead of a bool, to customize how
> add_failure() is called?

makes sense. will do!
Assignee: nobody → jlund
Whiteboard: [mozharness]
Summary: add error_on_failure option in mozharness's run_command() → add failure_config parameter to mozharness's run_command()
Component: General Automation → Mozharness
Closed: 1 year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.