mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 18:28:52 +08:00
kill the wait statements.
This commit is contained in:
@@ -34,6 +34,7 @@ import koji
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _finalize(config, session, msg, state):
|
||||
""" Called whenever a koji build completes or fails. """
|
||||
|
||||
@@ -48,12 +49,21 @@ def _finalize(config, session, msg, state):
|
||||
component_build.state = state
|
||||
session.commit()
|
||||
|
||||
if component_build.package == 'module-build-macros':
|
||||
module_name = component_build.module_build.name
|
||||
tag = component_build.module_build.koji_tag
|
||||
builder = rida.builder.KojiModuleBuilder(module_name, config, tag_name=tag)
|
||||
# tag && add to srpm-build group
|
||||
builder.buildroot_add_artifacts([component_build.package,], install=True)
|
||||
session.commit()
|
||||
|
||||
# Find all of the sibling builds of this particular build.
|
||||
parent = component_build.module_build
|
||||
siblings = parent.component_builds
|
||||
|
||||
# Are any of them still executing?
|
||||
if any([c.state == koji.BUILD_STATES['BUILDING'] for c in siblings]):
|
||||
premature = (koji.BUILD_STATES['BUILDING'], None)
|
||||
if any([c.state in premature for c in siblings]):
|
||||
# Then they're not all done yet... continue to wait
|
||||
return
|
||||
|
||||
@@ -66,6 +76,7 @@ def _finalize(config, session, msg, state):
|
||||
|
||||
# Otherwise.. if all of the builds succeeded, then mark the module as good.
|
||||
parent.transition(config, rida.BUILD_STATES['done'])
|
||||
session.commit()
|
||||
|
||||
|
||||
def complete(config, session, msg):
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
import rida.builder
|
||||
import rida.database
|
||||
import rida.pdc
|
||||
|
||||
import koji
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
@@ -77,16 +80,17 @@ def wait(config, session, msg):
|
||||
builder.buildroot_add_dependency(dependencies)
|
||||
# inject dist-tag into buildroot
|
||||
srpm = builder.get_disttag_srpm(disttag=".%s" % get_rpm_release_from_tag(tag))
|
||||
task_id = builder.build(artifact_name="module-build-macros", source=srpm)
|
||||
|
||||
# TODO -- this has to go eventually.. otherwise, we can only build one
|
||||
# module at a time and that just won't scale.
|
||||
builder.wait_task(task_id)
|
||||
# TODO -- do cleanup if this fails
|
||||
|
||||
artifact = get_artifact_from_srpm(srpm)
|
||||
builder.buildroot_add_artifacts([artifact,], install=True) # tag && add to srpm-build group
|
||||
builder.buildroot_ready(artifacts=[artifact,])
|
||||
|
||||
build.transition(config, state="build") # Wait for the buildroot to be ready.
|
||||
artifact_name = "module-build-macros"
|
||||
task_id = builder.build(artifact_name=artifact_name, source=srpm)
|
||||
component_build = rida.database.ComponentBuild(
|
||||
module_id=build.id,
|
||||
package=artifact_name,
|
||||
format="rpms",
|
||||
scmurl=srpm,
|
||||
task_id=task_id,
|
||||
state = koji.BUILD_STATES['BUILDING'],
|
||||
)
|
||||
session.add(component_build)
|
||||
build.transition(config, state="build")
|
||||
session.commit()
|
||||
|
||||
Reference in New Issue
Block a user