mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-14 00:40:02 +08:00
Revert "Store the component's build ID and use that to identify the build when acting on a tag message"
This reverts commit 9bd16beeef.
This commit is contained in:
@@ -610,7 +610,6 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules
|
||||
component_build.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_build.nvr = build['nvr']
|
||||
component_build.task_id = build['task_id']
|
||||
component_build.build_id = build['build_id']
|
||||
component_build.state_reason = 'Found existing build'
|
||||
nvr_dict = kobo.rpmlib.parse_nvr(component_build.nvr)
|
||||
# Trigger a completed build message
|
||||
@@ -631,8 +630,7 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules
|
||||
log.info('The build being skipped isn\'t tagged in the "{0}" tag. Will send a '
|
||||
'message to the tag handler'.format(tag))
|
||||
further_work.append(module_build_service.messaging.KojiTagChange(
|
||||
'recover_orphaned_artifact: fake message', tag, component_build.package,
|
||||
component_build.build_id))
|
||||
'recover_orphaned_artifact: fake message', tag, component_build.package))
|
||||
return further_work
|
||||
|
||||
def build(self, artifact_name, source):
|
||||
|
||||
@@ -157,8 +157,7 @@ class FedmsgMessageParser(MessageParser):
|
||||
elif category == 'buildsys' and event == 'tag':
|
||||
tag = msg_inner_msg.get('tag')
|
||||
artifact = msg_inner_msg.get('name')
|
||||
build_id = msg_inner_msg.get('build_id')
|
||||
msg_obj = KojiTagChange(msg_id, tag, artifact, build_id)
|
||||
msg_obj = KojiTagChange(msg_id, tag, artifact)
|
||||
|
||||
elif category == 'mbs' and object == 'module' and \
|
||||
subobject == 'state' and event == 'change':
|
||||
@@ -210,11 +209,10 @@ class KojiTagChange(BaseMessage):
|
||||
:param tag: the name of tag (e.g. module-123456789-build)
|
||||
:param artifact: the name of tagged artifact (e.g. module-build-macros)
|
||||
"""
|
||||
def __init__(self, msg_id, tag, artifact, build_id):
|
||||
def __init__(self, msg_id, tag, artifact):
|
||||
super(KojiTagChange, self).__init__(msg_id)
|
||||
self.tag = tag
|
||||
self.artifact = artifact
|
||||
self.build_id = build_id
|
||||
|
||||
|
||||
class KojiRepoChange(BaseMessage):
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
"""Add the component build_id column
|
||||
|
||||
Revision ID: c702c2d26a8b
|
||||
Revises: 9d5e6938588f
|
||||
Create Date: 2018-08-03 15:28:38.493950
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c702c2d26a8b'
|
||||
down_revision = '9d5e6938588f'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('component_builds') as b:
|
||||
b.add_column(sa.Column('build_id', sa.Integer(), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('component_builds') as b:
|
||||
b.drop_column('build_id')
|
||||
@@ -658,8 +658,7 @@ class ComponentBuild(MBSBase):
|
||||
scmurl = db.Column(db.String, nullable=False)
|
||||
# XXX: Consider making this a proper ENUM
|
||||
format = db.Column(db.String, nullable=False)
|
||||
build_id = db.Column(db.Integer) # This is the id of the build in Koji
|
||||
task_id = db.Column(db.Integer) # This is the id of the build task in Koji
|
||||
task_id = db.Column(db.Integer) # This is the id of the build in koji
|
||||
# This is the commit hash that component was built with
|
||||
ref = db.Column(db.String, nullable=True)
|
||||
# XXX: Consider making this a proper ENUM (or an int)
|
||||
@@ -709,18 +708,12 @@ class ComponentBuild(MBSBase):
|
||||
return session.query(cls).filter_by(
|
||||
package=component_name, module_id=module_id).first()
|
||||
|
||||
@classmethod
|
||||
def from_component_build_id(cls, session, build_id, module_id):
|
||||
return session.query(cls).filter_by(
|
||||
build_id=build_id, module_id=module_id).first()
|
||||
|
||||
def state_trace(self, component_id):
|
||||
return ComponentBuildTrace.query.filter_by(
|
||||
component_id=component_id).order_by(ComponentBuildTrace.state_time).all()
|
||||
|
||||
def json(self):
|
||||
retval = {
|
||||
'build_id': self.build_id,
|
||||
'id': self.id,
|
||||
'package': self.package,
|
||||
'format': self.format,
|
||||
@@ -765,9 +758,8 @@ class ComponentBuild(MBSBase):
|
||||
return json
|
||||
|
||||
def __repr__(self):
|
||||
return ("<ComponentBuild %s, %r, state: %r, build_id: %r, task_id: %r, batch: %r, "
|
||||
"state_reason: %s>") % (self.package, self.module_id, self.state, self.build_id,
|
||||
self.task_id, self.batch, self.state_reason)
|
||||
return "<ComponentBuild %s, %r, state: %r, task_id: %r, batch: %r, state_reason: %s>" % (
|
||||
self.package, self.module_id, self.state, self.task_id, self.batch, self.state_reason)
|
||||
|
||||
|
||||
class ComponentBuildTrace(MBSBase):
|
||||
|
||||
@@ -62,7 +62,6 @@ def _finalize(config, session, msg, state):
|
||||
component_build.state = state
|
||||
component_build.nvr = nvr
|
||||
component_build.state_reason = state_reason
|
||||
component_build.build_id = msg.build_id
|
||||
session.commit()
|
||||
|
||||
parent = component_build.module_build
|
||||
|
||||
@@ -44,8 +44,8 @@ def tagged(config, session, msg):
|
||||
return
|
||||
|
||||
# Find tagged component.
|
||||
component = models.ComponentBuild.from_component_build_id(
|
||||
session, msg.build_id, module_build.id)
|
||||
component = models.ComponentBuild.from_component_name(
|
||||
session, msg.artifact, module_build.id)
|
||||
if not component:
|
||||
log.error("No component %s in module %r", msg.artifact, module_build)
|
||||
return
|
||||
|
||||
@@ -58,14 +58,13 @@ def reuse_component(component, previous_component_build,
|
||||
component.state_reason = \
|
||||
'Reused component from previous module build'
|
||||
component.nvr = previous_component_build.nvr
|
||||
component.build_id = previous_component_build.build_id
|
||||
nvr_dict = kobo.rpmlib.parse_nvr(component.nvr)
|
||||
# Add this message to further_work so that the reused
|
||||
# component will be tagged properly
|
||||
return [
|
||||
module_build_service.messaging.KojiBuildChange(
|
||||
msg_id='reuse_component: fake msg',
|
||||
build_id=component.build_id,
|
||||
build_id=None,
|
||||
task_id=component.task_id,
|
||||
build_new_state=previous_component_build.state,
|
||||
build_name=component.package,
|
||||
|
||||
@@ -149,7 +149,6 @@ def _populate_data(session, data_size=10, contexts=False):
|
||||
('git://pkgs.domain.local/rpms/nginx?'
|
||||
'#ga95886c8a443b36a9ce31abda1f9bed22f2f8c3')
|
||||
component_one_build_one.format = 'rpms'
|
||||
component_one_build_one.build_id = 2345 + index
|
||||
component_one_build_one.task_id = 12312345 + index
|
||||
component_one_build_one.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_one_build_one.nvr = 'nginx-1.10.1-2.{0}'.format(build_one_component_release)
|
||||
@@ -164,7 +163,6 @@ def _populate_data(session, data_size=10, contexts=False):
|
||||
('/tmp/module_build_service-build-macrosWZUPeK/SRPMS/'
|
||||
'module-build-macros-0.1-1.module_nginx_1_2.src.rpm')
|
||||
component_two_build_one.format = 'rpms'
|
||||
component_two_build_one.build_id = 4356 + index
|
||||
component_two_build_one.task_id = 12312321 + index
|
||||
component_two_build_one.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_two_build_one.nvr = \
|
||||
@@ -202,7 +200,6 @@ def _populate_data(session, data_size=10, contexts=False):
|
||||
('git://pkgs.domain.local/rpms/postgresql?'
|
||||
'#dc95586c4a443b26a9ce38abda1f9bed22f2f8c3')
|
||||
component_one_build_two.format = 'rpms'
|
||||
component_one_build_two.build_id = 345345 + index
|
||||
component_one_build_two.task_id = 2433433 + index
|
||||
component_one_build_two.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_one_build_two.nvr = 'postgresql-9.5.3-4.{0}'.format(build_two_component_release)
|
||||
@@ -217,7 +214,6 @@ def _populate_data(session, data_size=10, contexts=False):
|
||||
('/tmp/module_build_service-build-macrosWZUPeK/SRPMS/'
|
||||
'module-build-macros-0.1-1.module_postgresql_1_2.src.rpm')
|
||||
component_two_build_two.format = 'rpms'
|
||||
component_two_build_two.build_id = 567567 + index
|
||||
component_two_build_two.task_id = 47383993 + index
|
||||
component_two_build_two.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_two_build_two.nvr = \
|
||||
@@ -254,7 +250,6 @@ def _populate_data(session, data_size=10, contexts=False):
|
||||
('git://pkgs.domain.local/rpms/rubygem-rails?'
|
||||
'#dd55886c4a443b26a9ce38abda1f9bed22f2f8c3')
|
||||
component_one_build_three.format = 'rpms'
|
||||
component_one_build_three.build_id = 345353 + index
|
||||
component_one_build_three.task_id = 2433433 + index
|
||||
component_one_build_three.state = koji.BUILD_STATES['FAILED']
|
||||
component_one_build_three.nvr = \
|
||||
@@ -268,7 +263,6 @@ def _populate_data(session, data_size=10, contexts=False):
|
||||
('/tmp/module_build_service-build-macrosWZUPeK/SRPMS/'
|
||||
'module-build-macros-0.1-1.module_testmodule_1_2.src.rpm')
|
||||
component_two_build_three.format = 'rpms'
|
||||
component_two_build_three.build_id = 83732 + index
|
||||
component_two_build_three.task_id = 47383993 + index
|
||||
component_two_build_three.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_two_build_three.nvr = \
|
||||
@@ -437,7 +431,6 @@ def reuse_component_init_data():
|
||||
('git://pkgs.fedoraproject.org/rpms/perl-Tangerine'
|
||||
'?#4ceea43add2366d8b8c5a622a2fb563b625b9abf')
|
||||
component_one_build_one.format = 'rpms'
|
||||
component_one_build_one.build_id = 23456
|
||||
component_one_build_one.task_id = 90276227
|
||||
component_one_build_one.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_one_build_one.nvr = \
|
||||
@@ -453,7 +446,6 @@ def reuse_component_init_data():
|
||||
('git://pkgs.fedoraproject.org/rpms/perl-List-Compare'
|
||||
'?#76f9d8c8e87eed0aab91034b01d3d5ff6bd5b4cb')
|
||||
component_two_build_one.format = 'rpms'
|
||||
component_two_build_one.build_id = 23457
|
||||
component_two_build_one.task_id = 90276228
|
||||
component_two_build_one.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_two_build_one.nvr = \
|
||||
@@ -469,7 +461,6 @@ def reuse_component_init_data():
|
||||
('git://pkgs.fedoraproject.org/rpms/tangerine'
|
||||
'?#fbed359411a1baa08d4a88e0d12d426fbf8f602c')
|
||||
component_three_build_one.format = 'rpms'
|
||||
component_three_build_one.build_id = 23458
|
||||
component_three_build_one.task_id = 90276315
|
||||
component_three_build_one.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_three_build_one.nvr = \
|
||||
@@ -485,7 +476,6 @@ def reuse_component_init_data():
|
||||
('/tmp/module_build_service-build-macrosqr4AWH/SRPMS/module-build-'
|
||||
'macros-0.1-1.module_testmodule_master_20170109091357.src.rpm')
|
||||
component_four_build_one.format = 'rpms'
|
||||
component_four_build_one.build_id = 23459
|
||||
component_four_build_one.task_id = 90276181
|
||||
component_four_build_one.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_four_build_one.nvr = \
|
||||
@@ -552,7 +542,6 @@ def reuse_component_init_data():
|
||||
('/tmp/module_build_service-build-macrosqr4AWH/SRPMS/module-build-'
|
||||
'macros-0.1-1.module_testmodule_master_20170219191323.src.rpm')
|
||||
component_four_build_two.format = 'rpms'
|
||||
component_four_build_two.build_id = 456789
|
||||
component_four_build_two.task_id = 90276186
|
||||
component_four_build_two.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_four_build_two.nvr = \
|
||||
|
||||
@@ -103,7 +103,6 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
on_cancel_cb = None
|
||||
on_buildroot_add_artifacts_cb = None
|
||||
on_tag_artifacts_cb = None
|
||||
component_ids = {}
|
||||
|
||||
@module_build_service.utils.validate_koji_tag('tag_name')
|
||||
def __init__(self, owner, module, config, tag_name, components):
|
||||
@@ -121,7 +120,6 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
FakeModuleBuilder.on_tag_artifacts_cb = None
|
||||
FakeModuleBuilder.DEFAULT_GROUPS = None
|
||||
FakeModuleBuilder.backend = 'test'
|
||||
FakeModuleBuilder.component_ids = {}
|
||||
|
||||
def buildroot_connect(self, groups):
|
||||
default_groups = FakeModuleBuilder.DEFAULT_GROUPS or {
|
||||
@@ -157,10 +155,15 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
FakeModuleBuilder.on_buildroot_add_artifacts_cb(self, artifacts, install)
|
||||
if self.backend == 'test':
|
||||
for nvr in artifacts:
|
||||
component = models.ComponentBuild.query.filter_by(nvr=nvr).first()
|
||||
# buildroot_add_artifacts received a list of NVRs, but the tag message expects the
|
||||
# component name. At this point, the NVR may not be set if we are trying to reuse
|
||||
# all components, so we can't search the database. We must parse the package name
|
||||
# from the nvr and then tag it in the build tag. Kobo doesn't work when parsing
|
||||
# the NVR of a component with a module dist-tag, so we must manually do it.
|
||||
package_name = nvr.split('.module')[0].rsplit('-', 2)[0]
|
||||
# When INSTANT_COMPLETE is on, the components are already in the build tag
|
||||
if self.INSTANT_COMPLETE is False:
|
||||
self._send_tag(component, dest_tag=False)
|
||||
self._send_tag(package_name, dest_tag=False)
|
||||
elif self.backend == 'testlocal':
|
||||
self._send_repo_done()
|
||||
|
||||
@@ -175,8 +178,8 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
for nvr in artifacts:
|
||||
# tag_artifacts received a list of NVRs, but the tag message expects the
|
||||
# component name
|
||||
component = models.ComponentBuild.query.filter_by(nvr=nvr).first()
|
||||
self._send_tag(component, dest_tag=dest_tag)
|
||||
artifact = models.ComponentBuild.query.filter_by(nvr=nvr).first().package
|
||||
self._send_tag(artifact, dest_tag=dest_tag)
|
||||
|
||||
@property
|
||||
def koji_session(self):
|
||||
@@ -199,20 +202,15 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
)
|
||||
module_build_service.scheduler.consumer.work_queue_put(msg)
|
||||
|
||||
def _send_tag(self, component, dest_tag=True):
|
||||
def _send_tag(self, artifact, dest_tag=True):
|
||||
if dest_tag:
|
||||
tag = self.tag_name
|
||||
else:
|
||||
tag = self.tag_name + "-build"
|
||||
|
||||
if not FakeModuleBuilder.component_ids.get(component.package):
|
||||
FakeModuleBuilder.component_ids[component.package] = component.build_id
|
||||
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
msg_id='a faked internal message',
|
||||
tag=tag,
|
||||
artifact=component.package,
|
||||
build_id=FakeModuleBuilder.component_ids[component.package]
|
||||
artifact=artifact
|
||||
)
|
||||
module_build_service.scheduler.consumer.work_queue_put(msg)
|
||||
|
||||
@@ -232,10 +230,7 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
|
||||
def build(self, artifact_name, source):
|
||||
print("Starting building artifact %s: %s" % (artifact_name, source))
|
||||
# Make sure we have consistent component IDs on every message
|
||||
if artifact_name not in FakeModuleBuilder.component_ids:
|
||||
FakeModuleBuilder.component_ids[artifact_name] = randint(1000, 9999999)
|
||||
build_id = FakeModuleBuilder.component_ids[artifact_name]
|
||||
build_id = randint(1000, 9999999)
|
||||
|
||||
if FakeModuleBuilder.on_build_cb:
|
||||
FakeModuleBuilder.on_build_cb(self, artifact_name, source)
|
||||
@@ -269,21 +264,17 @@ class FakeModuleBuilder(GenericBuilder):
|
||||
component_build.state = koji.BUILD_STATES['COMPLETE']
|
||||
component_build.nvr = nvr
|
||||
component_build.task_id = component_build.id + 51234
|
||||
if component_build.package not in FakeModuleBuilder.component_ids:
|
||||
FakeModuleBuilder.component_ids[component_build.package] = component_build.id + 123
|
||||
component_build.build_id = FakeModuleBuilder.component_ids[component_build.package]
|
||||
component_build.state_reason = 'Found existing build'
|
||||
nvr_dict = kobo.rpmlib.parse_nvr(component_build.nvr)
|
||||
# Send a message stating the build is complete
|
||||
msgs.append(module_build_service.messaging.KojiBuildChange(
|
||||
'recover_orphaned_artifact: fake message', component_build.build_id,
|
||||
'recover_orphaned_artifact: fake message', randint(1, 9999999),
|
||||
component_build.task_id, koji.BUILD_STATES['COMPLETE'], component_build.package,
|
||||
nvr_dict['version'], nvr_dict['release'], component_build.module_build.id))
|
||||
# Send a message stating that the build was tagged in the build tag
|
||||
msgs.append(module_build_service.messaging.KojiTagChange(
|
||||
'recover_orphaned_artifact: fake message',
|
||||
component_build.module_build.koji_tag + '-build', component_build.package,
|
||||
component_build.build_id))
|
||||
component_build.module_build.koji_tag + '-build', component_build.package))
|
||||
return msgs
|
||||
|
||||
def finalize(self):
|
||||
|
||||
@@ -45,7 +45,7 @@ class TestTagTagged:
|
||||
"""
|
||||
from_tag_change_event.return_value = None
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'no matches for this...', '2016-some-nonexistent-build', "artifact", 12345)
|
||||
'no matches for this...', '2016-some-nonexistent-build', "artifact")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -56,8 +56,7 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"artifact",
|
||||
12345)
|
||||
"artifact")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -86,35 +85,28 @@ class TestTagTagged:
|
||||
|
||||
# Set previous components as COMPLETE and tagged.
|
||||
module_build.batch = 1
|
||||
i = 0
|
||||
for c in module_build.up_to_current_batch():
|
||||
c.state = koji.BUILD_STATES["COMPLETE"]
|
||||
c.tagged = True
|
||||
c.tagged_in_final = True
|
||||
c.build_id = 456790 + i
|
||||
i += 1
|
||||
|
||||
module_build.batch = 2
|
||||
for c in module_build.current_batch():
|
||||
c.state = koji.BUILD_STATES["COMPLETE"]
|
||||
c.build_id = 456790 + i
|
||||
i += 1
|
||||
db.session.commit()
|
||||
|
||||
# Tag the first component to the buildroot.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-Tangerine",
|
||||
456791)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the first component to the final tag.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-Tangerine",
|
||||
456791)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -126,8 +118,7 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -139,8 +130,7 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -182,23 +172,20 @@ class TestTagTagged:
|
||||
component = module_build_service.models.ComponentBuild.query\
|
||||
.filter_by(package='perl-Tangerine', module_id=module_build.id).one()
|
||||
component.state = koji.BUILD_STATES["BUILDING"]
|
||||
component.build_id = 123456
|
||||
db.session.commit()
|
||||
|
||||
# Tag the perl-List-Compare component to the buildroot.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-Tangerine",
|
||||
123456)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the perl-List-Compare component to final tag.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-Tangerine",
|
||||
123456)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -239,11 +226,9 @@ class TestTagTagged:
|
||||
module_build.batch = 2
|
||||
component = module_build_service.models.ComponentBuild.query\
|
||||
.filter_by(package='perl-Tangerine', module_id=module_build.id).one()
|
||||
component.build_id = 456791
|
||||
component.state = koji.BUILD_STATES["FAILED"]
|
||||
component = module_build_service.models.ComponentBuild.query\
|
||||
.filter_by(package='perl-List-Compare', module_id=module_build.id).one()
|
||||
component.build_id = 456792
|
||||
component.state = koji.BUILD_STATES["COMPLETE"]
|
||||
db.session.commit()
|
||||
|
||||
@@ -251,16 +236,14 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the perl-List-Compare component to final tag.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -307,14 +290,6 @@ class TestTagTagged:
|
||||
module_id=3, package='module-build-macros').one()
|
||||
mbm.tagged = False
|
||||
db.session.add(mbm)
|
||||
pt = module_build_service.models.ComponentBuild.query.filter_by(
|
||||
module_id=3, package='perl-Tangerine').one()
|
||||
pt.build_id = 456791
|
||||
db.session.add(pt)
|
||||
plc = module_build_service.models.ComponentBuild.query.filter_by(
|
||||
module_id=3, package='perl-List-Compare').one()
|
||||
plc.build_id = 456792
|
||||
db.session.add(plc)
|
||||
for c in module_build.current_batch():
|
||||
c.state = koji.BUILD_STATES["COMPLETE"]
|
||||
db.session.commit()
|
||||
@@ -323,16 +298,14 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-Tangerine",
|
||||
456791)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the first component to the final tag.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-Tangerine",
|
||||
456791)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -344,16 +317,14 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the second component to final tag.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -365,16 +336,14 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"module-build-macros",
|
||||
456789)
|
||||
"module-build-macros")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the component from first batch to the buildroot.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"module-build-macros",
|
||||
456789)
|
||||
"module-build-macros")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
@@ -428,19 +397,16 @@ class TestTagTagged:
|
||||
component.build_time_only = True
|
||||
component.tagged = False
|
||||
component.tagged_in_final = False
|
||||
component.build_id = 456791
|
||||
component = module_build_service.models.ComponentBuild.query\
|
||||
.filter_by(package='perl-List-Compare', module_id=module_build.id).one()
|
||||
component.state = koji.BUILD_STATES["COMPLETE"]
|
||||
component.build_id = 456792
|
||||
db.session.commit()
|
||||
|
||||
# Tag the perl-Tangerine component to the buildroot.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-Tangerine",
|
||||
456791)
|
||||
"perl-Tangerine")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
assert not koji_session.newRepo.called
|
||||
@@ -448,16 +414,14 @@ class TestTagTagged:
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c-build',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
# Tag the perl-List-Compare component to final tag.
|
||||
msg = module_build_service.messaging.KojiTagChange(
|
||||
'id',
|
||||
'module-testmodule-master-20170219191323-c40c156c',
|
||||
"perl-List-Compare",
|
||||
456792)
|
||||
"perl-List-Compare")
|
||||
module_build_service.scheduler.handlers.tags.tagged(
|
||||
config=conf, session=db.session, msg=msg)
|
||||
|
||||
|
||||
@@ -441,7 +441,6 @@ class TestViews:
|
||||
def test_query_component_build(self):
|
||||
rv = self.client.get('/module-build-service/1/component-builds/1')
|
||||
data = json.loads(rv.data)
|
||||
assert data['build_id'] == 2345
|
||||
assert data['id'] == 1
|
||||
assert data['format'] == 'rpms'
|
||||
assert data['module_build'] == 2
|
||||
@@ -454,7 +453,6 @@ class TestViews:
|
||||
def test_query_component_build_short(self):
|
||||
rv = self.client.get('/module-build-service/1/component-builds/1?short=True')
|
||||
data = json.loads(rv.data)
|
||||
assert data['build_id'] == 2345
|
||||
assert data['id'] == 1
|
||||
assert data['format'] == 'rpms'
|
||||
assert data['module_build'] == 2
|
||||
@@ -467,7 +465,6 @@ class TestViews:
|
||||
def test_query_component_build_verbose(self):
|
||||
rv = self.client.get('/module-build-service/1/component-builds/3?verbose=true')
|
||||
data = json.loads(rv.data)
|
||||
assert data['build_id'] == 345345
|
||||
assert data['id'] == 3
|
||||
assert data['format'] == 'rpms'
|
||||
assert data['module_build'] == 3
|
||||
|
||||
Reference in New Issue
Block a user