#1701 Fixes for allow_dashes_in_svc enforcement
Merged 2 years ago by mikem. Opened 2 years ago by mikem.
mikem/fm-orchestrator dashes-part-deux  into  master

@@ -621,6 +621,7 @@ 

          rebuild_strategy=None,

          scratch=False,

          srpms=None,

+         commit=True,

          **kwargs

      ):

          now = datetime.utcnow()
@@ -650,7 +651,8 @@ 

              module.buildrequires.append(base_module)

  

          db_session.add(module)

-         db_session.commit()

+         if commit:

+             db_session.commit()

          return module

  

      def transition(self, db_session, conf, state, state_reason=None, failure_type="unspec"):

@@ -102,11 +102,11 @@ 

          if isinstance(stream_or_packager, Modulemd.ModuleStream):

              # this is a ModuleStreamV2 object

              stream_or_packager = stream_or_packager.copy(stream_or_packager.get_module_name(),

-                                                          scm.branch)

+                                                          scm_stream)

          else:

              # this is a PackagerV3 object

              stream_or_packager = stream_or_packager.copy()

-             stream_or_packager.set_stream_name(scm.branch)

+             stream_or_packager.set_stream_name(scm_stream)

  

      # If the version is in the modulemd, throw an exception since the version

      # since the version is generated by MBS

@@ -701,6 +701,8 @@ 

                  reused_module_id=params.get("reuse_components_from"),

                  scratch=params.get("scratch"),

                  srpms=params.get("srpms"),

+                 # don't commit now, we do it ourselves below

+                 commit=False,

              )

              module.build_context, module.runtime_context, module.context, \

                  module.build_context_no_bms = module.contexts_from_mmd(module.modulemd)

This is a follow up to #1700, which doesn't work as expected. There are two fixes here.

First, we actually use the scm_stream value that the previous patch sets, instead of scm.branch. This was an oversight in #1700

Second, we defer the commit of the module build entry until after we set the context and check the scv values. This was arguably a problem before now, but the checks added in #1700 exacerbated the situation by causing a failure before the correct context was set, resulting in a stray entry with the default context value of 0000000. This stray entry caused successive build submissions to fail.

Build a8adfd4 FAILED!
Rebase or make new commits to rebuild.

Commit f1b9a4a fixes this pull-request

Pull-Request has been merged by mikem

2 years ago