mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-24 10:43:16 +08:00
Handle module builds without components
This commit is contained in:
@@ -267,6 +267,16 @@ def wait(config, session, msg):
|
||||
log.debug("Adding dependencies %s into buildroot for module %s" % (dependencies, module_info))
|
||||
builder.buildroot_add_repos(dependencies)
|
||||
|
||||
if not build.component_builds:
|
||||
log.info("There are no components in module %r, skipping build" % build)
|
||||
build.transition(config, state="build")
|
||||
session.add(build)
|
||||
session.commit()
|
||||
# Return a KojiRepoChange message so that the build can be transitioned to done
|
||||
# in the repos handler
|
||||
return [module_build_service.messaging.KojiRepoChange(
|
||||
'handlers.modules.wait: fake msg', builder.module_build_tag['name'])]
|
||||
|
||||
# If all components in module build will be reused, we don't have to build
|
||||
# module-build-macros, because there won't be any build done.
|
||||
if attempt_to_reuse_all_components(builder, session, build):
|
||||
|
||||
@@ -54,7 +54,11 @@ def done(config, session, msg):
|
||||
log.info("Ignoring repo regen for already failed %r" % module_build)
|
||||
return
|
||||
|
||||
current_batch = module_build.current_batch()
|
||||
# If there are no components in this module build, then current_batch will be empty
|
||||
if not module_build.component_builds:
|
||||
current_batch = []
|
||||
else:
|
||||
current_batch = module_build.current_batch()
|
||||
|
||||
# If any in the current batch are still running.. just wait.
|
||||
running = [c.state == koji.BUILD_STATES['BUILDING'] for c in current_batch]
|
||||
@@ -74,7 +78,7 @@ def done(config, session, msg):
|
||||
# logic over in the component handler which should fail the module build
|
||||
# first before we ever get here. This is here as a race condition safety
|
||||
# valve.
|
||||
if not good:
|
||||
if module_build.component_builds and not good:
|
||||
module_build.transition(config, models.BUILD_STATES['failed'],
|
||||
"Some components failed to build.")
|
||||
session.commit()
|
||||
|
||||
@@ -194,10 +194,13 @@ class MBSProducer(PollingProducer):
|
||||
'the concurrent build threshold being met')
|
||||
return
|
||||
|
||||
# Check to see if module builds that are in build state but don't have
|
||||
# any component builds being built can be worked on
|
||||
for module_build in session.query(models.ModuleBuild) \
|
||||
.filter_by(state=models.BUILD_STATES['build']).all():
|
||||
# Check for module builds that are in the build state but don't have any active component
|
||||
# builds. Exclude module builds in batch 0. This is likely a build of a module without
|
||||
# components.
|
||||
module_builds = session.query(models.ModuleBuild).filter(
|
||||
models.ModuleBuild.state == models.BUILD_STATES['build'],
|
||||
models.ModuleBuild.batch > 0).all()
|
||||
for module_build in module_builds:
|
||||
# If there are no components in the build state on the module build,
|
||||
# then no possible event will start off new component builds.
|
||||
# But do not try to start new builds when we are waiting for the
|
||||
|
||||
Reference in New Issue
Block a user