#1746 Add default branch configuration option
Merged 2 years ago by breilly. Opened 2 years ago by breilly.
breilly/fm-orchestrator main-1735  into  master

@@ -700,6 +700,11 @@ 

                      "which buildrequires to automatically include. This can be overridden with "

                      "the xmd.mbs.default_modules_scm_url key in the base module's modulemd.",

          },

+         "default_branch": {

+             "type": str,

+             "default": "master",

+             "desc": "Denotes the default branch.",

+         },

          "uses_rawhide": {

              "type": bool,

              "default": True,

@@ -71,8 +71,8 @@ 

          If url is not in the list of allowed_scm, an error will be raised.

  

          :param str url: The unmodified scmurl

-         :param str branch: The optional source control branch. This defaults to "master" when git

-             is used.

+         :param str branch: The optional source control branch. This defaults to the default_branch

+             config option when git is used.

          :param list allowed_scm: The optional list of allowed SCM URL prefixes

          :param bool allow_local: Allow SCM URLs that start with "file://"

          :raises: Forbidden or ValidationError
@@ -111,7 +111,7 @@ 

              if self.name.endswith(".git"):

                  self.name = self.name[:-4]

              self.commit = match.group("commit")

-             self.branch = branch if branch else "master"

+             self.branch = branch if branch else conf.default_branch

              self.version = None

              self._cloned = False

          else:

@@ -307,7 +307,7 @@ 

              if not pkg.get_cache():

                  pkg.set_cache(conf.rpms_default_cache + pkgname)

              if not pkg.get_ref():

-                 pkg.set_ref("master")

+                 pkg.set_ref(conf.default_branch)

              if not pkg.get_arches():

                  for arch in conf.arches:

                      pkg.add_restricted_arch(arch)
@@ -323,7 +323,7 @@ 

              if not mod.get_repository():

                  mod.set_repository(conf.modules_default_repository + modname)

              if not mod.get_ref():

-                 mod.set_ref("master")

+                 mod.set_ref(conf.default_branch)

  

          # It is possible to override the ref of RPM component using

          # the rpm_component_ref_overrides.

@@ -122,7 +122,7 @@ 

              '"module_name" parameter'

          )

      module_name = stream_or_packager.get_module_name() or def_name

-     module_stream = stream or stream_or_packager.get_stream_name() or "master"

+     module_stream = stream or stream_or_packager.get_stream_name() or conf.default_branch

      if module_name != stream_or_packager.get_module_name() or \

         module_stream != stream_or_packager.get_stream_name():

          # This is how you set the name and stream in the modulemd