]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
choose_teuthology_branch: Choose main later on
authorZack Cerza <zack@redhat.com>
Fri, 22 Jul 2022 21:12:42 +0000 (15:12 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 22 Jul 2022 21:12:42 +0000 (15:12 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/suite/run.py

index 1dcc2cd25aed6f7e91738e892bdafcb6c54363e8..29f18ede36cd01e0a55eb54103c15d97d5197804 100644 (file)
@@ -248,25 +248,29 @@ class Run(object):
                         log.warning(
                             'The teuthology branch config is empty, skipping')
         if not teuthology_branch:
-            teuthology_branch = config.get('teuthology_branch', 'main')
+            teuthology_branch = config.get('teuthology_branch')
 
-        if config.teuthology_path is None:
-            teuthology_sha1 = util.git_ls_remote(
-                'teuthology',
-                teuthology_branch
-            )
-        else:
+        if config.teuthology_path:
             actual_branch = repo_utils.current_branch(config.teuthology_path)
-            if actual_branch != teuthology_branch:
+            if teuthology_branch and actual_branch != teuthology_branch:
                 raise BranchMismatchError(
                     teuthology_branch,
                     config.teuthology_path,
                     "config.teuthology_path is set",
                 )
+            if not teuthology_branch:
+                teuthology_branch = actual_branch
             teuthology_sha1 = util.git_ls_remote(
                 f"file://{config.teuthology_path}",
                 teuthology_branch
             )
+        else:
+            if not teuthology_branch:
+                teuthology_branch = 'main'
+            teuthology_sha1 = util.git_ls_remote(
+                'teuthology',
+                teuthology_branch
+            )
         if not teuthology_sha1:
             exc = BranchNotFoundError(teuthology_branch, build_git_url('teuthology'))
             util.schedule_fail(message=str(exc), name=self.name)