Allow gather phase reuse on product_id change.

I've analysed multiple nigthly composes and often the only difference
in the configuration between two nightly composes is different
`product_id` commit hash.

The `product_id` is used in later `createrepo` phase and does not
influence the gather phase at all. I therefore think it can be
whitelisted in gather phase reuse code.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2020-04-06 09:43:16 +02:00 committed by lsedlar
parent c5e59fa732
commit fdfaae8b71
2 changed files with 29 additions and 0 deletions

View File

@ -251,6 +251,13 @@ def reuse_old_gather_packages(compose, arch, variant, package_sets):
)
return
continue
# Skip checking for frequently changing configuration options which do *not*
# influence Gather phase.
config_whitelist = ["product_id"]
if opt in config_whitelist:
continue
if opt not in config or config[opt] != value:
compose.log_info(
log_msg % ("compose configuration option %s changed." % opt)

View File

@ -1173,6 +1173,28 @@ class TestReuseOldGatherPackages(helpers.PungiTestCase):
)
self.assertEqual(result, None)
@mock.patch("pungi.phases.gather.load_old_gather_result")
@mock.patch("pungi.phases.gather.load_old_compose_config")
def test_reuse_compose_config_different_whitelist(
self, load_old_compose_config, load_old_gather_result
):
for whitelist_opt in ["product_id"]:
load_old_gather_result.return_value = {
"rpm": [{"path": "/build/bash-1.0.0-1.x86_64.rpm"}],
"srpm": [],
"debuginfo": [],
}
compose = helpers.DummyCompose(self.topdir, {"gather_allow_reuse": True})
compose_conf_copy = dict(compose.conf)
compose_conf_copy[whitelist_opt] = "different"
load_old_compose_config.return_value = compose_conf_copy
result = gather.reuse_old_gather_packages(
compose, "x86_64", compose.variants["Server"], []
)
self.assertEqual(result, {"rpm": [], "srpm": [], "debuginfo": []})
def _prepare_package_sets(
self, load_old_gather_result, extra_global_pkgs=None, **kwargs
):