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

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



  from module_build_service.builder.KojiModuleBuilder import KojiModuleBuilder

- from module_build_service.models import ModuleBuild


+ from module_build_service import models




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


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



      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

6 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: