From f9d8b673258b8d1c311535b4f43de90adda03a30 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Jun 19 2018 19:35:43 +0000 Subject: Add --fail-fast functionality. Signed-off-by: Jason Tibbitts --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index 3c8f5b3..79ca7f6 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -1891,7 +1891,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): + fail_fast=False, url=None, chain=None, arches=None, sets=False, + nvr_check=True): """Initiate a build of the module. Available options are: skip_tag: Skip the tag action after the build @@ -1900,6 +1901,9 @@ class Commands(object): background: Perform the build with a low priority + fail_fast: Perform the build in fast failure mode, which will cause the + entire build to fail if any subtask/architecture build fails. + url: A url to an uploaded srpm to build from chain: A chain build set @@ -1962,6 +1966,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 ac0d8fc..60443af 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -438,6 +438,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""" @@ -1402,9 +1405,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, + fail_fast=self.args.fail_fast, + url=url, + chain=chain, + arches=arches, + sets=sets, + nvr_check=nvr_check) # Log out of the koji session self.cmd.kojisession.logout()