commit:     26929ff836acfe559456bed9f400dd4879973d8b
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 10 21:46:50 2022 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Wed Aug 10 21:46:50 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=26929ff8

Use one scheduler for push and mr

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/config/schedulers.py | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/buildbot_gentoo_ci/config/schedulers.py 
b/buildbot_gentoo_ci/config/schedulers.py
index b769f00..60f1857 100644
--- a/buildbot_gentoo_ci/config/schedulers.py
+++ b/buildbot_gentoo_ci/config/schedulers.py
@@ -42,9 +42,17 @@ def getGitChanges(props):
     change_data['project'] = k['project']
     return change_data
 
-def mr_branch_fn(branch):
-    # if branch end with -mr or -pr
-    if branch[-3] == '-mr' or branch[-3] == '-pr':
+def bb_branch_fn(branch):
+    # check branch
+    print(f"Branch: {branch}")
+    if branch.endswith('-mr') or branch.endswith('-pr') or branch == 'master':
+        return True
+    return False
+
+def bb_category_fn(category):
+    # check event
+    print(f"Category: {category}")
+    if category == 'push' or category == 'merge_request':
         return True
     return False
 
@@ -56,16 +64,7 @@ def gentoo_schedulers():
                         change_data = getGitChanges
                         ),
         builderNames = builderUpdateDbNames,
-        change_filter=util.ChangeFilter(branch='master', category='push'),
-    )
-    scheduler_update_db_mr= schedulers.SingleBranchScheduler(
-        name='scheduler_update_db_mr',
-        treeStableTimer=0,
-        properties = dict(
-                        change_data = getGitChanges
-                        ),
-        builderNames = builderUpdateDbNames,
-        change_filter=util.ChangeFilter(branch_fn=mr_branch_fn, 
category='merge_request'),
+        change_filter=util.ChangeFilter(branch_fn=bb_branch_fn, 
category_fn=bb_category_fn),
     )
     create_stage4 = schedulers.ForceScheduler(
         name="create_stage4",
@@ -102,7 +101,6 @@ def gentoo_schedulers():
     s = []
     s.append(create_stage4)
     s.append(scheduler_update_db)
-    s.append(scheduler_update_db_mr)
     s.append(update_repo_check)
     s.append(update_cpv_data)
     s.append(update_v_data)

Reply via email to