mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-24 02:32:26 +08:00
Allow resubmiting the very same module build in case it results in new MSE build.
This is needed for Fedora branching, but it is generally useful. For example, there is a module buildrequiring "platform:[]". In the time this module has been built, only platform:f29 existed, so it has been built just against platform:f29. After a while, the platform:f30 is released and the maintainer needs to rebuild the module against platform:f30. Right now, he needs to create new commit in the module and submit the build, but this will result in useless rebuild of the module also against platform:f29. In this commit, MBS allows to resubmit the module build in a case there are new MSE builds to build. MBS will send all the module builds back to the user - so the existing builds will be already marked as "ready" and the newly submitted builds will have the "init" state in the REST API response. However, in case when there are no new MSE builds to build, MBS still sends back the Conflict error as it used to. This is done for backwards compatibility and also to not confuse the users in case when no new build has been submitted.
This commit is contained in:
@@ -30,7 +30,7 @@ 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, init_data,
|
||||
scheduler_init_data)
|
||||
scheduler_init_data, make_module)
|
||||
import mock
|
||||
import koji
|
||||
import pytest
|
||||
@@ -667,6 +667,31 @@ class TestUtils:
|
||||
v = module_build_service.utils.submit.get_prefixed_version(mmd)
|
||||
assert v == 7000120180205135154
|
||||
|
||||
@patch('module_build_service.utils.submit.generate_expanded_mmds')
|
||||
def test_submit_build_new_mse_build(self, generate_expanded_mmds):
|
||||
"""
|
||||
Tests that finished build can be resubmitted in case the resubmitted
|
||||
build adds new MSE build (it means there are new expanded
|
||||
buildrequires).
|
||||
"""
|
||||
build = make_module("foo:stream:0:c1", {}, {})
|
||||
assert build.state == models.BUILD_STATES['ready']
|
||||
|
||||
mmd1 = build.mmd()
|
||||
mmd2 = build.mmd()
|
||||
mmd2.set_context("c2")
|
||||
|
||||
generate_expanded_mmds.return_value = [mmd1, mmd2]
|
||||
|
||||
builds = module_build_service.utils.submit_module_build("foo", "bar", mmd1)
|
||||
ret = {b.mmd().get_context(): b.state for b in builds}
|
||||
assert ret == {
|
||||
"c1": models.BUILD_STATES['ready'],
|
||||
"c2": models.BUILD_STATES['init']}
|
||||
|
||||
assert builds[0].siblings == [builds[1].id]
|
||||
assert builds[1].siblings == [builds[0].id]
|
||||
|
||||
|
||||
class DummyModuleBuilder(GenericBuilder):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user