Only complete the module build when *all components are tagged* and a KojiRepoRegen message is received

This commit is contained in:
mprahl
2017-11-09 15:36:39 -05:00
parent 243e8873d5
commit bb0dde9936
8 changed files with 129 additions and 29 deletions

View File

@@ -118,17 +118,12 @@ def _finalize(config, session, msg, state):
log.info("Batch done. Tagging %i components." % len(
built_components_in_batch))
log.debug("%r" % built_components_in_batch)
install = bool(component_build.package == 'module-build-macros')
builder.buildroot_add_artifacts(built_components_in_batch, install=install)
builder.buildroot_add_artifacts(
built_components_in_batch, install=component_build.build_time_only)
# Do not tag packages which belong to -build tag to final tag.
if not install:
if not component_build.build_time_only:
builder.tag_artifacts(built_components_in_batch)
else:
# For components which should not be tagged in final Koji tag,
# set the build_time_only to True so we do not wait for the
# non-existing tagging task to finish.
component_build.build_time_only = True
session.commit()
elif (any([c.state != koji.BUILD_STATES['BUILDING']

View File

@@ -329,6 +329,7 @@ def wait(config, session, msg):
state_reason=reason,
nvr=nvr,
batch=1,
build_time_only=True
)
session.add(component_build)

View File

@@ -54,6 +54,18 @@ def done(config, session, msg):
log.info("Ignoring repo regen for already failed %r" % module_build)
return
# Get the list of untagged components in current/previous batches which
# have been built successfully
if config.system in ('koji', 'test') and module_build.component_builds:
untagged_components = [
c for c in module_build.up_to_current_batch()
if (not c.tagged or (not c.tagged_in_final and not c.build_time_only)) and
c.state == koji.BUILD_STATES['COMPLETE']
]
if untagged_components:
log.info("Ignoring repo regen, because not all components are tagged.")
return
# If there are no components in this module build, then current_batch will be empty
if not module_build.component_builds:
current_batch = []

View File

@@ -34,8 +34,7 @@ logging.basicConfig(level=logging.DEBUG)
def tagged(config, session, msg):
""" Called whenever koji tags a build to tag. """
if not config.system == "koji":
if config.system not in ("koji", "test"):
return []
# Find our ModuleBuild associated with this tagged artifact.