replace BUILD_HISTORY_DIRECTPUSH with hardcoded condition
cover replace BUILD_HISTORY_DIRECTPUSH with hardcoded condition
From: Alexis Lothoré <[email protected]>
This series is a follow-up to [1], which hot-fixed tests results not being pushed by Autobuilder by enriching the BUILD_HISTORY_DIRECTPUSH variable with mickledore. Since the issue will likely happen for all new releases, this series brings in a better fix (suggested by Richard) to systematically include all "main" branches, based on their name and the target repository (poky). Since the new condition is based on the branch name, it assumes that except for the XXX-next branch, no other custom/non release branch will be pushed to poky (contrary to poky-contrib)
[1] https://lists.yoctoproject.org/g/yocto/topic/99523809#60297
Alexis Lothoré (3):
scripts/utils.py: replace BUILD_HISTORY_DIRECTPUSH with hardcoded
condition
config.json: remove BUILD_HISTORY_DIRECTPUSH scripts/test_utils.py: update test after BUILD_HISTORY_DIRECTPUSH
removal
config.json | 1 - scripts/test_utils.py | 29 +++++++---------------------- scripts/utils.py | 13 +++++++++++-- 3 files changed, 18 insertions(+), 25 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/3 scripts/utils.py: replace BUILD_HISTORY_DIRECTPUSH with hardcoded condition
From: Alexis Lothoré <[email protected]>
It has been observed that when a new release branch is created, it is quite easy to forget to update the BUILD_HISTORY_DIRECTPUSH variable, which leads to failures in autobuilder like test results not being pushed. Replace the BUILD_HISTORY_DIRECTPUSH usage with a hardcoded condition which validates any branch in poky representing a "main" branch, i.e all branches not ending in "-next"
--- scripts/utils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
scripts/utils.py +11 -2
@@ -19,6 +19,15 @@ import fnmatch import glob import fcntl + +def is_a_main_branch(reponame, branchname): + """ + Checks if target repo/branch combo represent a main branch. This + includes master and release branches in poky, while excluding "next" + branches + """ + return reponame == "poky" and not branchname.endswith("-next") + # # Check if config contains all the listed params #
@@ -212,7 +221,7 @@ def getbuildhistoryconfig(ourconfig, builddir, target, reponame, branchname, ste reponame = reponame.rsplit("/", 1)[1] if reponame.endswith(".git"): reponame = reponame[:-4] - if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_DIRECTPUSH", ourconfig): + if is_a_main_branch(reponame, branchname): base = reponame + ":" + branchname if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_FORKPUSH", ourconfig): base = getconfig("BUILD_HISTORY_FORKPUSH", ourconfig)[reponame + ":" + branchname]
@@ -392,7 +401,7 @@ def getcomparisonbranch(ourconfig, reponame, branchname): comparerepo, comparebranch = base.split(":") print("Comparing to %s\n" % (comparebranch)) return branchname, comparebranch - if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_DIRECTPUSH", ourconfig): + if is_a_main_branch(reponame, branchname): return branchname, None return None, None
Signature · 1 line
2.41.0
PATCH 2/3 config.json: remove BUILD_HISTORY_DIRECTPUSH
In reply to [email protected]From: Alexis Lothoré <[email protected]>
Now that BUILD_HISTORY_DIRECTPUSH has been replaced by a hardcoded condition, remove it from config.json
--- config.json | 1 - 1 file changed, 1 deletion(-)
config.json +0 -1
@@ -5,7 +5,6 @@ "BUILD_HISTORY_DIR" : "buildhistory", "BUILD_HISTORY_REPO" : "ssh://[email protected]/poky-buildhistory", - "BUILD_HISTORY_DIRECTPUSH" : ["poky:morty", "poky:pyro", "poky:rocko", "poky:sumo", "poky:thud", "poky:warrior", "poky:zeus", "poky:dunfell", "poky:gatesgarth", "poky:hardknott", "poky:honister", "poky:kirkstone", "poky:langdale", "poky:mickledore", "poky:master"], "BUILD_HISTORY_FORKPUSH" : {"poky-contrib:ross/mut" : "poky:master", "poky-contrib:abelloni/master-next": "poky:master", "poky:master-next" : "poky:master"}, "BUILDTOOLS_URL_TEMPLOCAL" : "/srv/autobuilder/autobuilder.yocto.io/pub/non-release/20210214-8/buildtools/x86_64-buildtools-extended-nativesdk-standalone-3.2+snapshot-7d38cc8e749aedb8435ee71847e04b353cca541d.sh",
Signature · 1 line
2.41.0
PATCH 3/3 scripts/test_utils.py: update test after BUILD_HISTORY_DIRECTPUSH removal
In reply to [email protected]From: Alexis Lothoré <[email protected]>
Update getcomparisonbranch unit tests by removing BUILD_HISTORY_DIRECTPUSH entry in fake configuration
--- scripts/test_utils.py | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-)
scripts/test_utils.py +7 -22
@@ -7,22 +7,7 @@ import utils class TestGetComparisonBranch(unittest.TestCase): TEST_CONFIG = { - "BUILD_HISTORY_DIRECTPUSH": [ - "poky:morty", - "poky:pyro", - "poky:rocko", - "poky:sumo", - "poky:thud", - "poky:warrior", - "poky:zeus", - "poky:dunfell", - "poky:gatesgarth", - "poky:hardknott", - "poky:honister", - "poky:kirkstone", - "poky:langdale", - "poky:master" - ], "BUILD_HISTORY_FORKPUSH": { + "BUILD_HISTORY_FORKPUSH": { "poky-contrib:ross/mut": "poky:master", "poky:master-next": "poky:master", "poky-contrib:abelloni/master-next": "poky:master"
@@ -35,9 +20,9 @@ class TestGetComparisonBranch(unittest.TestCase): basebranch, comparebranch = utils.getcomparisonbranch( self.TEST_CONFIG, repo, branch) self.assertEqual( - basebranch, "master", msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding base branch") + basebranch, "master", msg="Release branch in poky must return corresponding base branch") self.assertEqual( - comparebranch, None, msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding compare branch") + comparebranch, None, msg="Release branch in poky must return corresponding compare branch") def test_release_kirkstone(self): repo = "ssh://[email protected]/poky"
@@ -45,9 +30,9 @@ class TestGetComparisonBranch(unittest.TestCase): basebranch, comparebranch = utils.getcomparisonbranch( self.TEST_CONFIG, repo, branch) self.assertEqual(basebranch, "kirkstone", - msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding base branch") + msg="Release branch in poky must return corresponding base branch") self.assertEqual( - comparebranch, None, msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding compare branch") + comparebranch, None, msg="Release branch in poky must return corresponding compare branch") def test_release_langdale(self): repo = "ssh://[email protected]/poky"
@@ -55,9 +40,9 @@ class TestGetComparisonBranch(unittest.TestCase): basebranch, comparebranch = utils.getcomparisonbranch( self.TEST_CONFIG, repo, branch) self.assertEqual(basebranch, "langdale", - msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding base branch") + msg="Release branch in poky must return corresponding base branch") self.assertEqual( - comparebranch, None, msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding compare branch") + comparebranch, None, msg="Release branch in poky must return corresponding compare branch") def test_master_next(self): repo = "ssh://[email protected]/poky"
Signature · 1 line
2.41.0