From 8bb44e794cf56315b2a874a6976ce2c4f51a2e06 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Sep 19 2017 15:55:13 +0000 Subject: PR#432: override build_arch_can_fail settings Merges #432 https://pagure.io/koji/pull-request/432 Fixes: #413 https://pagure.io/koji/issue/413 --- diff --git a/builder/kojid b/builder/kojid index 2203f1d..258949a 100755 --- a/builder/kojid +++ b/builder/kojid @@ -889,9 +889,12 @@ class BuildTask(BaseTaskHandler): #scratch builds do not get imported build_id = self.session.host.initBuild(data) #(initBuild raises an exception if there is a conflict) + failany = (self.opts.get('fail_fast', False) + or not getattr(self.options, 'build_arch_can_fail', False)) try: self.extra_information = { "src": src, "data": data, "target": target } - srpm,rpms,brmap,logs = self.runBuilds(srpm, build_tag, archlist, repo_info['id']) + srpm,rpms,brmap,logs = self.runBuilds(srpm, build_tag, archlist, + repo_info['id'], failany=failany) if opts.get('scratch'): #scratch builds do not get imported @@ -1034,7 +1037,7 @@ class BuildTask(BaseTaskHandler): return 'noarch' - def runBuilds(self, srpm, build_tag, archlist, repo_id): + def runBuilds(self, srpm, build_tag, archlist, repo_id, failany=True): self.logger.debug("Spawning jobs for arches: %r" % (archlist)) subtasks = {} keep_srpm = True @@ -1051,7 +1054,6 @@ class BuildTask(BaseTaskHandler): self.logger.debug("Waiting on subtasks...") # wait for subtasks to finish - failany = not getattr(self.options, 'build_arch_can_fail', False) results = self.wait(subtasks.values(), all=True, failany=failany) # finalize import diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 982314f..56a0446 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -438,6 +438,8 @@ def handle_build(options, session, args): parser.add_option("--quiet", action="store_true", help=_("Do not print the task information"), default=options.quiet) parser.add_option("--arch-override", help=_("Override build arches")) + parser.add_option("--fail-fast", action="store_true", + help=_("Override build_arch_can_fail settings and fail as fast as possible")) parser.add_option("--repo-id", type="int", help=_("Use a specific repo")) parser.add_option("--noprogress", action="store_true", help=_("Do not display progress of the upload")) @@ -467,7 +469,7 @@ def handle_build(options, session, args): opts = {} if build_opts.arch_override: opts['arch_override'] = parse_arches(build_opts.arch_override) - for key in ('skip_tag', 'scratch', 'repo_id'): + for key in ('skip_tag', 'scratch', 'repo_id', 'fail_fast'): val = getattr(build_opts, key) if val is not None: opts[key] = val diff --git a/tests/test_cli/test_build.py b/tests/test_cli/test_build.py index 1eff2e6..af97031 100644 --- a/tests/test_cli/test_build.py +++ b/tests/test_cli/test_build.py @@ -198,6 +198,8 @@ Options: --quiet Do not print the task information --arch-override=ARCH_OVERRIDE Override build arches + --fail-fast Override build_arch_can_fail settings and fail as fast + as possible --repo-id=REPO_ID Use a specific repo --noprogress Do not display progress of the upload --background Run the build at a lower priority