#500 Revert "Revert "No need to convert compose ids or verify 'done' state""
Merged 4 years ago by gnaponie. Opened 4 years ago by gnaponie.
gnaponie/freshmaker revert-the-revert  into  master

file modified
+12 -28
@@ -533,34 +533,18 @@ 

          if args["renewed_odcs_compose_ids"]:

              compose_ids += args["renewed_odcs_compose_ids"]

  

-         # OSBS cannot handle both repo_urls and compose_ids in the same time.

-         # We use repo_urls only in special cases to build base images. In this

-         # cases, we want to convert compose_ids to repository URLs. Otherwise,

-         # just pass compose_ids to OSBS via Koji.

-         if repo_urls is not None:

-             for compose_id in compose_ids:

-                 odcs_compose = self.odcs_get_compose(compose_id)

-                 if odcs_compose["state"] in [COMPOSE_STATES['wait'],

-                                              COMPOSE_STATES['generating']]:

-                     # In case the ODCS compose is still generating, raise an

-                     # exception.

-                     msg = ("Compose %s is not in done state. Waiting with "

-                            "rebuild." % (str(compose_id)))

-                     self.log_info(msg)

-                     raise ODCSComposeNotReady(msg)

-                 elif odcs_compose["state"] != COMPOSE_STATES["done"]:

-                     # In case the compose is not in 'done' state, mark the

-                     # build as failed. We should never get expired here,

-                     # because the compose has been submitted just a minutes

-                     # ago. If we get "expired" here, it is sign of an issue,

-                     # because that means we are trying to build quite old

-                     # image.

-                     build.transition(

-                         ArtifactBuildState.FAILED.value,

-                         "Compose %s is not in 'done' state." % str(compose_id))

-                     return

-                 repo_urls.append(odcs_compose["result_repofile"])

-             compose_ids = []

+         for compose_id in compose_ids:

+             odcs_compose = self.odcs_get_compose(compose_id)

+             if odcs_compose["state"] in [COMPOSE_STATES['wait'],

+                                          COMPOSE_STATES['generating']]:

+                 # In case the ODCS compose is still generating, raise an

+                 # exception.

+                 msg = ("Compose %s has not been generated yet. Waiting with "

+                        "rebuild." % (str(compose_id)))

+                 self.log_info(msg)

+                 raise ODCSComposeNotReady(msg)

+             # OSBS can renew a compose if it needs to, so we can just pass

+             # it along without further verification for other states.

  

          return self.build_container(

              scm_url, branch, target, repo_urls=repo_urls,

file modified
+2 -5
@@ -218,13 +218,10 @@ 

          handler = MyHandler()

          handler.build_image_artifact_build(self.build_1, ["http://localhost/x.repo"])

  

-         repo_urls = [

-             'http://localhost/x.repo', 'http://localhost/5.repo',

-             'http://localhost/6.repo', 'http://localhost/7.repo',

-             'http://localhost/8.repo']

+         repo_urls = ['http://localhost/x.repo']

          build_container.assert_called_once_with(

              'git://pkgs.fedoraproject.org/repo#hash', 'branch', 'target',

-             arch_override='x86_64', compose_ids=[], isolated=True,

+             arch_override='x86_64', compose_ids=[5, 6, 7, 8], isolated=True,

              koji_parent_build=None, release='2', repo_urls=repo_urls)

  

      @patch("freshmaker.handlers.ContainerBuildHandler.build_container")