diff mbox series

[yocto-autobuilder-helper,3/3] scripts: send_qa_email: do not try to generate a regression report when missing base and/or target

Message ID 20240621155723.33600-4-alexis.lothore@bootlin.com
State New
Headers show
Series scripts: send_qa_email: skip regression report when missing base or target | expand

Commit Message

Alexis Lothoré June 21, 2024, 3:57 p.m. UTC
From: Alexis Lothoré <alexis.lothore@bootlin.com>

Fixes [YOCTO 15503]

When running autobuilder onm a testing or stable branch, the following
exception may occur:

Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/a-full/yocto-autobuilder-helper/scripts/send_qa_email.py", line 278, in <module>
    send_qa_email()
  File "/home/pokybuild/yocto-worker/a-full/yocto-autobuilder-helper/scripts/send_qa_email.py", line 207, in send_qa_email
    generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log)
  File "/home/pokybuild/yocto-worker/a-full/yocto-autobuilder-helper/scripts/send_qa_email.py", line 93, in generate_regression_report
    regreport = subprocess.check_output([querytool, "regression-report", base, target, '-t', resultdir])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.11/subprocess.py", line 1883, in _execute_child
    self.pid = _fork_exec(
               ^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType

This issue is due to base and target revision being None, but subprocess
module do not tolerate arguments being None,

Prevent the script from even trying to generate a regression report if we
are missing some info about revisions to compare.

Cc: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 scripts/send_qa_email.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py
index e258fa131fcb..39e938284972 100755
--- a/scripts/send_qa_email.py
+++ b/scripts/send_qa_email.py
@@ -203,8 +203,11 @@  def send_qa_email():
             utils.printheader("Processing regression report")
             try:
                 regression_base, regression_target = get_regression_base_and_target(targetbranch, basebranch, args.release, targetrepodir, test_results_url, log)
-                log.info(f"Generating regression report between {regression_base} and {regression_target}")
-                generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log)
+                if regression_base and regression_target:
+                    log.info(f"Generating regression report between {regression_base} and {regression_target}")
+                    generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log)
+                else:
+                    log.info("Can not guess regression base and/or target, skip regression report")
             except subprocess.CalledProcessError as e:
                 error = str(e)
                 exitcode = 1