Add an incrementing prefix to the dist_hash.

For #823.
This commit is contained in:
Ralph Bean
2018-01-15 15:50:41 -05:00
parent 482a846659
commit 01c8295269
6 changed files with 32 additions and 27 deletions

View File

@@ -1401,7 +1401,11 @@ def get_rpm_release(module_build):
dist_str = '.'.join([module_build.name, module_build.stream, str(module_build.version),
str(module_build.context)])
dist_hash = hashlib.sha1(dist_str).hexdigest()[:8]
return conf.default_dist_tag_prefix + dist_hash
return "{prefix}{index}+{dist_hash}".format(
prefix=conf.default_dist_tag_prefix,
index=module_build.id or 0,
dist_hash=dist_hash,
)
def create_dogpile_key_generator_func(skip_first_n_args=0):

View File

@@ -780,9 +780,9 @@ class TestBuild(unittest.TestCase):
# Check that components are tagged after the batch is built.
tag_groups = []
tag_groups.append(set(
['perl-Tangerine-0.23-1.module+814cfa39',
'perl-List-Compare-0.53-5.module+814cfa39',
'tangerine-0.22-3.module+814cfa39']))
['perl-Tangerine-0.23-1.module+0+814cfa39',
'perl-List-Compare-0.53-5.module+0+814cfa39',
'tangerine-0.22-3.module+0+814cfa39']))
def on_tag_artifacts_cb(cls, artifacts, dest_tag=True):
if dest_tag is True:
@@ -791,9 +791,9 @@ class TestBuild(unittest.TestCase):
buildtag_groups = []
buildtag_groups.append(set(
['perl-Tangerine-0.23-1.module+814cfa39',
'perl-List-Compare-0.53-5.module+814cfa39',
'tangerine-0.22-3.module+814cfa39']))
['perl-Tangerine-0.23-1.module+0+814cfa39',
'perl-List-Compare-0.53-5.module+0+814cfa39',
'tangerine-0.22-3.module+0+814cfa39']))
def on_buildroot_add_artifacts_cb(cls, artifacts, install):
self.assertEqual(buildtag_groups.pop(0), set(artifacts))
@@ -840,9 +840,9 @@ class TestBuild(unittest.TestCase):
# Check that components are tagged after the batch is built.
tag_groups = []
tag_groups.append(set(
['perl-Tangerine-0.23-1.module+814cfa39',
'perl-List-Compare-0.53-5.module+814cfa39',
'tangerine-0.22-3.module+814cfa39']))
['perl-Tangerine-0.23-1.module+0+814cfa39',
'perl-List-Compare-0.53-5.module+0+814cfa39',
'tangerine-0.22-3.module+0+814cfa39']))
def on_tag_artifacts_cb(cls, artifacts, dest_tag=True):
if dest_tag is True:
@@ -851,9 +851,9 @@ class TestBuild(unittest.TestCase):
buildtag_groups = []
buildtag_groups.append(set(
['perl-Tangerine-0.23-1.module+814cfa39',
'perl-List-Compare-0.53-5.module+814cfa39',
'tangerine-0.22-3.module+814cfa39']))
['perl-Tangerine-0.23-1.module+0+814cfa39',
'perl-List-Compare-0.53-5.module+0+814cfa39',
'tangerine-0.22-3.module+0+814cfa39']))
def on_buildroot_add_artifacts_cb(cls, artifacts, install):
self.assertEqual(buildtag_groups.pop(0), set(artifacts))

View File

@@ -126,7 +126,7 @@ class TestKojiBuilder(unittest.TestCase):
builder.module_tag = {"name": "module-foo", "id": 1}
builder.module_build_tag = {"name": "module-foo-build", "id": 2}
dist_tag = 'module+b8661ee4'
dist_tag = 'module+1+b8661ee4'
# Set listTagged to return test data
builder.koji_session.listTagged.side_effect = [[], [], []]
untagged = [{

View File

@@ -385,10 +385,10 @@ class TestPoller(unittest.TestCase):
self.assertEqual(module_build_two.state, models.BUILD_STATES['failed'])
# Make sure the builds were untagged
builder.untag_artifacts.assert_called_once_with([
'perl-Tangerine-0.23-1.module+814cfa39',
'perl-List-Compare-0.53-5.module+814cfa39',
'tangerine-0.22-3.module+814cfa39',
'module-build-macros-0.1-1.module+814cfa39'
'perl-Tangerine-0.23-1.module+0+814cfa39',
'perl-List-Compare-0.53-5.module+0+814cfa39',
'tangerine-0.22-3.module+0+814cfa39',
'module-build-macros-0.1-1.module+0+814cfa39'
])
def test_cleanup_stale_failed_builds_no_components(self, create_builder, koji_get_session,

View File

@@ -80,6 +80,7 @@ class FakeSCM(object):
class TestUtils(unittest.TestCase):
maxDiff = None
def setUp(self):
self.filtered_rpms = [

View File

@@ -142,13 +142,13 @@ class TestViews(unittest.TestCase):
'task_id': 12312321,
'state': 1,
'state_reason': None,
'nvr': 'module-build-macros-01-1.module+b8661ee4',
'nvr': 'module-build-macros-01-1.module+0+b8661ee4',
},
'nginx': {
'task_id': 12312345,
'state': 1,
'state_reason': None,
'nvr': 'nginx-1.10.1-2.module+b8661ee4',
'nvr': 'nginx-1.10.1-2.module+0+b8661ee4',
},
},
})
@@ -199,13 +199,13 @@ class TestViews(unittest.TestCase):
'task_id': 12312321,
'state': 1,
'state_reason': None,
'nvr': 'module-build-macros-01-1.module+b8661ee4',
'nvr': 'module-build-macros-01-1.module+0+b8661ee4',
},
'nginx': {
'task_id': 12312345,
'state': 1,
'state_reason': None,
'nvr': 'nginx-1.10.1-2.module+b8661ee4',
'nvr': 'nginx-1.10.1-2.module+0+b8661ee4',
},
},
})
@@ -262,13 +262,13 @@ class TestViews(unittest.TestCase):
'tasks': {
'rpms': {
'module-build-macros': {
'nvr': 'module-build-macros-01-1.module+8d3cee59',
'nvr': 'module-build-macros-01-1.module+0+8d3cee59',
'state': 1,
'state_reason': None,
'task_id': 47384002
},
'rubygem-rails': {
'nvr': 'postgresql-9.5.3-4.module+8d3cee59',
'nvr': 'postgresql-9.5.3-4.module+0+8d3cee59',
'state': 3,
'state_reason': None,
'task_id': 2433442
@@ -296,13 +296,13 @@ class TestViews(unittest.TestCase):
'tasks': {
'rpms': {
'module-build-macros': {
'nvr': 'module-build-macros-01-1.module+0557c87d',
'nvr': 'module-build-macros-01-1.module+0+0557c87d',
'state': 1,
'state_reason': None,
'task_id': 47384002
},
'postgresql': {
'nvr': 'postgresql-9.5.3-4.module+0557c87d',
'nvr': 'postgresql-9.5.3-4.module+0+0557c87d',
'state': 1,
'state_reason': None,
'task_id': 2433442
@@ -391,7 +391,7 @@ class TestViews(unittest.TestCase):
def test_query_component_builds_filter_nvr(self):
rv = self.client.get('/module-build-service/1/component-builds/?nvr=nginx-1.10.1-2.'
'module%2Bb8661ee4')
'module%2B0%2Bb8661ee4')
data = json.loads(rv.data)
self.assertEquals(data['meta']['total'], 10)