mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-13 16:29:49 +08:00
Merge #905 Share the same "index" in the dist tag between all MSE builds.
This commit is contained in:
@@ -178,9 +178,16 @@ def get_rpm_release(module_build):
|
||||
dist_str = '.'.join([module_build.name, module_build.stream, str(module_build.version),
|
||||
str(module_build.context)]).encode('utf-8')
|
||||
dist_hash = hashlib.sha1(dist_str).hexdigest()[:8]
|
||||
|
||||
# We need to share the same auto-incrementing index in dist tag between all MSE builds.
|
||||
# We can achieve that by using the lowest build ID of all the MSE siblings including
|
||||
# this module build.
|
||||
mse_build_ids = module_build.siblings + [module_build.id or 0]
|
||||
mse_build_ids.sort()
|
||||
index = mse_build_ids[0]
|
||||
return "{prefix}{index}+{dist_hash}".format(
|
||||
prefix=conf.default_dist_tag_prefix,
|
||||
index=module_build.id or 0,
|
||||
index=index,
|
||||
dist_hash=dist_hash,
|
||||
)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import module_build_service.scm
|
||||
from module_build_service import models, conf
|
||||
from module_build_service.errors import ProgrammingError, ValidationError, UnprocessableEntity
|
||||
from tests import (
|
||||
reuse_component_init_data, db, reuse_shared_userspace_init_data, clean_database)
|
||||
reuse_component_init_data, db, reuse_shared_userspace_init_data, clean_database, init_data)
|
||||
import mock
|
||||
import koji
|
||||
import pytest
|
||||
@@ -239,6 +239,15 @@ class TestUtils:
|
||||
def teardown_method(self, test_method):
|
||||
clean_database()
|
||||
|
||||
def test_get_rpm_release_mse(self):
|
||||
init_data(contexts=True)
|
||||
build_one = models.ModuleBuild.query.get(2)
|
||||
build_two = models.ModuleBuild.query.get(3)
|
||||
release_one = module_build_service.utils.get_rpm_release(build_one)
|
||||
release_two = module_build_service.utils.get_rpm_release(build_two)
|
||||
assert release_one == "module+2+b8645bbb"
|
||||
assert release_two == "module+2+17e35784"
|
||||
|
||||
@pytest.mark.parametrize('scmurl', [
|
||||
('git://pkgs.stg.fedoraproject.org/modules/testmodule.git'
|
||||
'?#620ec77321b2ea7b0d67d82992dda3e1d67055b4'),
|
||||
|
||||
Reference in New Issue
Block a user