From 765e64012913a7b5584d47f097a8fee133e81b03 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mar 18 2019 17:27:57 +0000 Subject: Allow setting the Koji tag extra options using the `conf.koji_tag_extra_opts`. The Koji tag extra options used to be hard-coded and to change them, we had to release new MBS version. We do not change them often, but right now fedora-infra is requesting to use new `mock.new_chroot` option and we need to release new MBS because of that. This commit makes such changes easier in the future. --- diff --git a/module_build_service/builder/KojiModuleBuilder.py b/module_build_service/builder/KojiModuleBuilder.py index 4bdcce5..1776ffa 100644 --- a/module_build_service/builder/KojiModuleBuilder.py +++ b/module_build_service/builder/KojiModuleBuilder.py @@ -23,6 +23,7 @@ # Luboš Kocman +import copy import logging import os import koji @@ -947,14 +948,8 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules if taginfo['perm'] not in (perm_id, perm): # check either id or the string opts['perm'] = perm_id - opts['extra'] = { - 'mock.package_manager': 'dnf', - # This is needed to include all the Koji builds (and therefore - # all the packages) from all inherited tags into this tag. - # See https://pagure.io/koji/issue/588 and - # https://pagure.io/fm-orchestrator/issue/660 for background. - 'repo_include_all': True, - } + # Create deepcopy of conf dict, because we are going to change it later. + opts['extra'] = copy.deepcopy(conf.koji_tag_extra_opts) xmd = self.mmd.get_xmd() if "mbs_options" in xmd.keys() and "repo_include_all" in xmd["mbs_options"].keys(): diff --git a/module_build_service/config.py b/module_build_service/config.py index c0aeabf..361d5fd 100644 --- a/module_build_service/config.py +++ b/module_build_service/config.py @@ -199,6 +199,21 @@ class Config(object): 'type': list, 'default': ['module', 'scrmod'], 'desc': 'List of allowed koji tag prefixes.'}, + 'koji_tag_extra_opts': { + 'type': dict, + 'default': { + 'mock.package_manager': 'dnf', + # This is needed to include all the Koji builds (and therefore + # all the packages) from all inherited tags into this tag. + # See https://pagure.io/koji/issue/588 and + # https://pagure.io/fm-orchestrator/issue/660 for background. + 'repo_include_all': True, + # Has been requested by Fedora infra in + # https://pagure.io/fedora-infrastructure/issue/7620. + # Disables systemd-nspawn for chroot. + 'mock.new_chroot': 0, + }, + 'desc': 'Extra options set for newly created Koji tags.'}, 'koji_target_delete_time': { 'type': int, 'default': 24 * 3600, diff --git a/tests/test_builder/test_koji.py b/tests/test_builder/test_koji.py index 6c73b90..afc59c9 100644 --- a/tests/test_builder/test_koji.py +++ b/tests/test_builder/test_koji.py @@ -517,10 +517,12 @@ class TestKojiBuilder: expected_calls = [mock.call('module-foo', arches=expected_arches, extra={'mock.package_manager': 'dnf', - 'repo_include_all': repo_include_all}), + 'repo_include_all': repo_include_all, + 'mock.new_chroot': 0}), mock.call('module-foo-build', arches=expected_arches, extra={'mock.package_manager': 'dnf', - 'repo_include_all': repo_include_all})] + 'repo_include_all': repo_include_all, + 'mock.new_chroot': 0})] assert session.editTag2.mock_calls == expected_calls @pytest.mark.parametrize('blocklist', [False, True])