diff mbox series

[yocto-autobuilder-helper,3/3] scripts/send_qa_email: return previous tag when running a non-release master build

Message ID 20230323092057.17918-4-alexis.lothore@bootlin.com
State New
Headers show
Series fix regression reporting for nightly build | expand

Commit Message

Alexis Lothoré March 23, 2023, 9:20 a.m. UTC
From: Alexis Lothoré <alexis.lothore@bootlin.com>

Some nightly builders are configured in yocto-autobuilder2 to run master builds.
Those build parameters currently skip all branches of
get_regression_base_and_target, which then return None, while the caller
expects a base and target tuple

Set default behaviour to return previous tag as comparison base and passed
branch as target for such builds

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 scripts/send_qa_email.py      | 3 +++
 scripts/test_send_qa_email.py | 2 ++
 2 files changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py
index 78e051a..4613bff 100755
--- a/scripts/send_qa_email.py
+++ b/scripts/send_qa_email.py
@@ -61,6 +61,9 @@  def get_regression_base_and_target(basebranch, comparebranch, release, targetrep
         # Basebranch/comparebranch is defined in config.json: regression reporting must be done against branches as defined in config.json
         return comparebranch, basebranch
 
+    #Default case: return previous tag as base
+    return get_previous_tag(targetrepodir, release), basebranch
+
 def generate_regression_report(querytool, targetrepodir, base, target, resultdir, outputdir):
     print(f"Comparing {target} to {base}")
 
diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py
index ce0c6b7..974112a 100755
--- a/scripts/test_send_qa_email.py
+++ b/scripts/test_send_qa_email.py
@@ -48,6 +48,8 @@  class TestVersion(unittest.TestCase):
                                           "comparebranch": "master", "release": None}, "expected": ("master", "master-next")},
         {"name": "Fork Master Next", "input": {"basebranch": "ross/mut",
                                                "comparebranch": "master", "release": None}, "expected": ("master", "ross/mut")},
+        {"name": "Nightly a-quick", "input": {"basebranch": "master",
+                                               "comparebranch": None, "release": "20230322-2"}, "expected": ("LAST_TAG", "master")},
     ]
 
     def test_versions(self):