Generate koji tag from MBS and use informative name

koji now supports tags with max length of 256, we can use
more informative tag name instead of the hash one.

The new format of koji tag name is:

    module-<name>-<stream>-<version>-<context>

However when the generated tag's length > (256 - len('build')), we
fallback to the old way of name in hash format (module-<hash>).

In this change, koji tag is always generated from MBS itself, even
with pdc resolver.

FIXES: #918 #925
This commit is contained in:
Qixiang Wan
2018-04-23 09:41:53 +08:00
parent 8351713828
commit 8b807a9fcd
9 changed files with 49 additions and 45 deletions

View File

@@ -535,6 +535,22 @@ class TestUtils:
for c in module_build.component_builds:
assert c.weight == 1.5
def test_generate_koji_tag_in_nsvc_format(self):
name, stream, version, context = ('testmodule', 'master', '20170816080815', '37c6c57')
tag = module_build_service.utils.generate_koji_tag(name, stream, version, context)
assert tag == 'module-testmodule-master-20170816080815-37c6c57'
def test_generate_koji_tag_in_hash_format(self):
name, version, context = ('testmodule', '20170816080815', '37c6c57')
stream = 'this-is-a-stream-with-very-looooong-name' + '-blah' * 50
nsvc_list = [name, stream, version, context]
tag = module_build_service.utils.generate_koji_tag(*nsvc_list)
expected_tag = 'module-1cf457d452e54dda'
assert tag == expected_tag
class DummyModuleBuilder(GenericBuilder):
"""