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.
This commit is contained in:
Jan Kaluza
2019-03-15 12:40:11 +01:00
committed by mprahl
parent 40e534ff9d
commit 765e640129
3 changed files with 22 additions and 10 deletions

View File

@@ -23,6 +23,7 @@
# Luboš Kocman <lkocman@redhat.com>
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():

View File

@@ -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,

View File

@@ -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])