From 018a42397e8dae23076f4e055834125b58d3e796 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Jul 04 2018 01:57:32 +0000 Subject: Add --fail-fast functionality Fixes #331 Merges: #332 Signed-off-by: Jason Tibbitts Signed-off-by: Chenxiong Qi --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index 4e1c9c7..bc2576e 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -1951,7 +1951,8 @@ class Commands(object): commit_hash or self.commithash) def build(self, skip_tag=False, scratch=False, background=False, - url=None, chain=None, arches=None, sets=False, nvr_check=True): + url=None, chain=None, arches=None, sets=False, nvr_check=True, + fail_fast=False): """Initiate a build. Available options are: skip_tag: Skip the tag action after the build @@ -1971,6 +1972,9 @@ class Commands(object): nvr_check: A boolean; locally construct NVR and submit a build only if NVR doesn't exist in a build system + fail_fast: Perform the build in fast failure mode, which will cause the + entire build to fail if any subtask/architecture build fails. + This function submits the task to koji and returns the taskID It is up to the client to wait or watch the task. @@ -2022,6 +2026,9 @@ class Commands(object): if background: cmd.append('--background') priority = 5 # magic koji number :/ + if fail_fast: + opts['fail_fast'] = True + cmd.append('--fail-fast') if arches: if not scratch: raise rpkgError('Cannot override arches for non-scratch ' diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py index 35cfba3..3349957 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -493,6 +493,9 @@ class cliClient(object): self.build_parser_common.add_argument( '--background', action='store_true', default=False, help='Run the build at a low priority') + self.build_parser_common.add_argument( + '--fail-fast', action='store_true', default=False, + help='Fail the build immediately if any arch fails') def register_rpm_common(self): """Create a common parser for rpm commands""" @@ -1457,9 +1460,15 @@ see API KEY section of copr-cli(1) man page. nvr_check = True if hasattr(self.args, 'nvr_check'): nvr_check = self.args.nvr_check - task_id = self.cmd.build(self.args.skip_tag, self.args.scratch, - self.args.background, url, chain, arches, - sets, nvr_check) + task_id = self.cmd.build(skip_tag=self.args.skip_tag, + scratch=self.args.scratch, + background=self.args.background, + url=url, + chain=chain, + arches=arches, + sets=sets, + nvr_check=nvr_check, + fail_fast=self.args.fail_fast) # Log out of the koji session self.cmd.kojisession.logout()