#12 Container-build: add --nowait option
Merged 8 years ago by pbabinca. Opened 8 years ago by araszka.
araszka/rpkg bz1257191  into  master

file modified
+10 -4
@@ -2341,7 +2341,7 @@ 

          self._run_command(cmd, shell=True)

  

      def osbs_build(self, config_file, config_section, target_override=False,

-                    yum_repourls=[]):

+                    yum_repourls=[], nowait=False):

          os_conf = Configuration(conf_file=config_file, conf_section=config_section)

          build_conf = Configuration(conf_file=config_file, conf_section=config_section)

          osbs = OSBS(os_conf, build_conf)
@@ -2368,6 +2368,11 @@ 

              yum_repourls=yum_repourls

          )

          build_id = build.build_id

+ 

+         if nowait:

+             self.log.info('Build submited: %s' % build_id)

+             return

+ 

          print("Build submitted (%s), watching logs (feel free to interrupt)" % build_id)

          for line in osbs.get_build_logs(build_id, follow=True):

              print(line)
@@ -2386,7 +2391,8 @@ 

  

      def container_build_koji(self, target_override=False, opts={},

                                     kojiconfig=None, build_client=None,

-                                    koji_task_watcher=None):

+                                    koji_task_watcher=None,

+                                    nowait=False):

  

          docker_target = self.target

          if not target_override:
@@ -2430,8 +2436,8 @@ 

              self.log.info('Created task: %s' % task_id)

              self.log.info('Task info: %s/taskinfo?taskID=%s' % (self.kojiweburl,

                                                                  task_id))

- 

-             koji_task_watcher(self.kojisession, [task_id])

+             if not nowait:

+                 koji_task_watcher(self.kojisession, [task_id])

          finally:

              (self.build_client, self.kojiconfig) = koji_session_backup

              self.load_kojisession()

file modified
+8 -2
@@ -832,6 +832,10 @@ 

                                              dest="build_with",

                                              choices=("koji", "osbs"),

                                              default="koji")

+         self.container_build_parser.add_argument('--nowait',

+                                             action='store_true',

+                                             default=False,

+                                             help="Don't wait on build")

  

          self.container_build_parser.set_defaults(command=self.container_build)

  
@@ -1057,7 +1061,8 @@ 

          self.cmd.container_build_koji(target_override, opts=opts,

                                        kojiconfig=kojiconfig,

                                        build_client=build_client,

-                                       koji_task_watcher=self._watch_koji_tasks)

+                                       koji_task_watcher=self._watch_koji_tasks,

+                                       nowait=self.args.nowait)

  

      def container_build_osbs(self):

          target_override = False
@@ -1070,7 +1075,8 @@ 

              config_file=self.args.osbs_config,

              config_section=self.args.instance,

              target_override=target_override,

-             yum_repourls=self.args.repo_url

+             yum_repourls=self.args.repo_url,

+             nowait=self.args.nowait

          )

  

      def container_build_setup(self):

no initial comment

Please rebase the pull request on the top of master.