#1089 Make the devel Koji CG build optional using a config option
Merged 7 months ago by mprahl. Opened 8 months ago by mprahl.

@@ -1201,7 +1201,8 @@ 

          if self.config.koji_enable_content_generator and self.module.state == 3:

              cg = KojiContentGenerator(self.module, self.config)

              cg.koji_import()

-             cg.koji_import(devel=True)

+             if conf.koji_cg_devel_module:

+                 cg.koji_import(devel=True)

  

      @staticmethod

      def get_rpm_module_tag(rpm):

@@ -428,6 +428,10 @@ 

              'default': True,

              'desc': 'Indicate whether tagging build is enabled during importing '

                      'module to Koji.'},

+         'koji_cg_devel_module': {

+             'type': bool,

+             'default': True,

+             'desc': 'Indicate whether a devel module should be imported into Koji.'},

          'koji_cg_build_tag_template': {

              'type': str,

              'default': "{}-modular-updates-candidate",

@@ -639,6 +639,33 @@ 

          rv = KojiModuleBuilder._get_filtered_rpms_on_self_dep(current_module, br_filtered_rpms)

          assert set(rv) == set(expected)

  

+     @pytest.mark.parametrize('cg_enabled,cg_devel_enabled', [

+         (False, False),

+         (True, False),

+         (True, True),

+     ])

+     @mock.patch('module_build_service.builder.KojiModuleBuilder.KojiContentGenerator')

+     def test_finalize(self, mock_koji_cg_cls, cg_enabled, cg_devel_enabled):

+         self.module.state = 3

+         with patch('module_build_service.config.Config.koji_enable_content_generator',

+                    new_callable=mock.PropertyMock, return_value=cg_enabled):

+             with patch('module_build_service.config.Config.koji_cg_devel_module',

+                        new_callable=mock.PropertyMock, return_value=cg_devel_enabled):

+                 builder = FakeKojiModuleBuilder(

+                     owner=self.module.owner, module=self.module, config=conf,

+                     tag_name='module-nginx-1.2', components=[])

+                 builder.finalize()

+ 

+         mock_koji_cg = mock_koji_cg_cls.return_value

+         if cg_enabled:

+             if cg_devel_enabled:

+                 assert mock_koji_cg.koji_import.call_count == 2

+                 mock_koji_cg.koji_import.assert_has_calls([mock.call(), mock.call(devel=True)])

+             else:

+                 mock_koji_cg.koji_import.assert_called_once_with()

+         else:

+             mock_koji_cg.koji_import.assert_not_called()

+ 

  

  class TestGetDistTagSRPM:

      """Test KojiModuleBuilder.get_disttag_srpm"""

Koji CG "-devel" modules aren't needed in the Fedora deployment of MBS. This PR makes those optional and default to off.

Usually it's safer to keep the existing behavior when making an existing thing optional.

I agree, but since it's a new change I thought it made the most sense to default this False since this is an internal only use-case. I'll put it back to True though.

rebased onto 102bf16b3a6bcabf6cd635232a40a34a3dfbde86

8 months ago

rebased onto 25b6a93

7 months ago

Pull-Request has been merged by mprahl

7 months ago