mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-05-16 13:56:11 +08:00
Dont create module if any build failed
This commit is contained in:
@@ -913,10 +913,15 @@ class CoprModuleBuilder(GenericBuilder):
|
|||||||
return response.data["ids"][0], koji.BUILD_STATES["COMPLETE"], response.message, None
|
return response.data["ids"][0], koji.BUILD_STATES["COMPLETE"], response.message, None
|
||||||
|
|
||||||
def _wait_until_all_builds_are_finished(self, module):
|
def _wait_until_all_builds_are_finished(self, module):
|
||||||
seconds = 60
|
while True:
|
||||||
unfinished = [b.task_id for b in module.component_builds]
|
states = {b: self.client.get_build_details(b.task_id).status for b in module.component_builds}
|
||||||
while unfinished:
|
if "failed" in states.values():
|
||||||
unfinished = filter(lambda x: self.client.get_build_details(x).status != "succeeded", unfinished)
|
raise ValueError("Some builds failed")
|
||||||
|
|
||||||
|
if not filter(lambda x: x != "succeeded", states.values()):
|
||||||
|
return
|
||||||
|
|
||||||
|
seconds = 60
|
||||||
log.info("Going to sleep for {}s to wait until builds in copr are finished".format(seconds))
|
log.info("Going to sleep for {}s to wait until builds in copr are finished".format(seconds))
|
||||||
time.sleep(seconds)
|
time.sleep(seconds)
|
||||||
|
|
||||||
@@ -930,7 +935,7 @@ class CoprModuleBuilder(GenericBuilder):
|
|||||||
from copr.exceptions import CoprRequestException
|
from copr.exceptions import CoprRequestException
|
||||||
try:
|
try:
|
||||||
self._wait_until_all_builds_are_finished(m1)
|
self._wait_until_all_builds_are_finished(m1)
|
||||||
except CoprRequestException:
|
except (CoprRequestException, ValueError):
|
||||||
return log.info("Missing builds, not going to create a module")
|
return log.info("Missing builds, not going to create a module")
|
||||||
|
|
||||||
# Create a module from previous project
|
# Create a module from previous project
|
||||||
|
|||||||
Reference in New Issue
Block a user