diff --git a/module_build_service/common/config.py b/module_build_service/common/config.py index e76bba80..84e5e226 100644 --- a/module_build_service/common/config.py +++ b/module_build_service/common/config.py @@ -700,6 +700,11 @@ class Config(object): "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, diff --git a/module_build_service/common/scm.py b/module_build_service/common/scm.py index c639702b..ff5da78a 100644 --- a/module_build_service/common/scm.py +++ b/module_build_service/common/scm.py @@ -71,8 +71,8 @@ class SCM(object): 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 @@ class SCM(object): 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: diff --git a/module_build_service/scheduler/submit.py b/module_build_service/scheduler/submit.py index 5334e125..60fc8f81 100644 --- a/module_build_service/scheduler/submit.py +++ b/module_build_service/scheduler/submit.py @@ -307,7 +307,7 @@ def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None): 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 @@ def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None): 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. diff --git a/module_build_service/web/submit.py b/module_build_service/web/submit.py index b9b2dcae..4866bffd 100644 --- a/module_build_service/web/submit.py +++ b/module_build_service/web/submit.py @@ -122,7 +122,7 @@ def submit_module_build_from_yaml( '"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