#1169 Allow setting the Koji tag extra options using the `conf.koji_tag_extra_opts`.
Merged 4 months ago by mprahl. Opened 4 months ago by jkaluza.
jkaluza/fm-orchestrator koji-tag-opts-in-conf  into  master

@@ -23,6 +23,7 @@ 

  #            Luboš Kocman <lkocman@redhat.com>

  

  

+ import copy

  import logging

  import os

  import koji

@@ -947,14 +948,8 @@ 

              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():

@@ -199,6 +199,21 @@ 

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

@@ -517,10 +517,12 @@ 

  

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

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.

rebased onto 765e640

4 months ago

Pull-Request has been merged by mprahl

4 months ago