#1036 MockModuleBuilder: Don't run the final createrepo if the module build failed
Closed 11 months ago by ralph. Opened a year ago by otaylor.
otaylor/fm-orchestrator mock-final-createrepo  into  master

@@ -46,7 +46,8 @@ 

      get_koji_config

  )

  from module_build_service.builder.KojiModuleBuilder import KojiModuleBuilder

- from module_build_service.models import ModuleBuild

+ 

+ from module_build_service import models

  

  logging.basicConfig(level=logging.DEBUG)

  

@@ -85,6 +86,7 @@ 

      @module_build_service.utils.validate_koji_tag('tag_name')

      def __init__(self, owner, module, config, tag_name, components):

          self.module_str = module.name

+         self.module = module

          self.tag_name = tag_name

          self.config = config

          self.groups = []

@@ -168,7 +170,7 @@ 

          pkglist_f = open(pkglist, "w")

  

          # Generate the mmd the same way as pungi does.

-         m1 = ModuleBuild.query.filter(ModuleBuild.name == self.module_str).one()

+         m1 = models.ModuleBuild.query.filter(models.ModuleBuild.name == self.module_str).one()

          m1_mmd = m1.mmd()

          artifacts = Modulemd.SimpleSet()

  

@@ -508,8 +510,11 @@ 

          pass

  

      def finalize(self):

-         # One last createrepo, to include the module metadata.

-         self._createrepo(include_module_yaml=True)

+         # If the state is "done", run one last createrepo, to include

+         # the module metadata. We don't want to do this for failed builds,

+         # since that makes it impossible to retry a build manually.

+         if self.module.state == models.BUILD_STATES["done"]:

+             self._createrepo(include_module_yaml=True)

  

  

  class BaseBuilder(object):

The build steps assume that the the repository for the build is non-modular,
so after the final createrepo is run with include_module_yaml=True, it's
impossible to repeat a build steps. Running mock -c <failed_config> build is
quite useful for debugging a failed build (even though it's hard to find the
right config) - skipping the final createrepo step for failed module builds
makes it work as expected.

Pagure's merge button is broken on this PR. I merged it manually in commit a42dd0d

@otaylor, I don't see a close button on this PR. Could you please close it if you can?

Pull-Request has been closed by ralph

11 months ago

I found it. It's called "cancel" in the top right corner.

Thanks @ralph. I didn't see the button, so it looks like I ran into the issue described at:
https://pagure.io/pagure/issue/3882