pkgset: ignore events for modular content tags

Generally we want all packages to come from particular event.

There are two exceptions: packages configured via `pkgset_koji_builds`
are pulled in by exact NVR and skip event; and modules in
`pkgset_koji_modules` are pulled in by NSVC and also ignore events.

However, the modular content tag did honor event, and could lead to a
crashed compose if the content tag did not exist at the configured
event.

This patch is a slightly too big hammer. It ignores events for all
modules, not just ones configured by explicit NSVC. It's not a huge deal
as the content tags are created before the corresponding module build is
created, and once all rpm builds are tagged into the content tag, MBS
will never change it again.

JIRA: RHELCMP-12765
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit b32c8f3e5e)
This commit is contained in:
Lubomír Sedlář 2023-10-24 10:16:06 +02:00 committed by Stepan Oksanichenko
parent 548441644b
commit fc86e03e44
Signed by: soksanichenko
GPG Key ID: AB9983172AB1E45B
2 changed files with 21 additions and 4 deletions

View File

@ -901,7 +901,13 @@ def populate_global_pkgset(compose, koji_wrapper, event):
if pkgset.reuse is None:
pkgset.populate(
compose_tag,
event,
# We care about packages as they existed on the specified
# event. However, modular content tags are not expected to
# change, so the event doesn't matter there. If an exact NSVC
# of a module is specified, the code above would happily find
# its content tag, but fail here if the content tag doesn't
# exist at the given event.
event=event if is_traditional else None,
inherit=should_inherit,
include_packages=modular_packages,
)

View File

@ -116,7 +116,14 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
self.assertEqual(len(pkgsets), 1)
self.assertIs(pkgsets[0], orig_pkgset)
pkgsets[0].assert_has_calls(
[mock.call.populate("f25", 123456, inherit=True, include_packages=set())],
[
mock.call.populate(
"f25",
event=123456,
inherit=True,
include_packages=set(),
),
],
)
def mock_materialize(self, compose, pkgset, prefix, mmd):
@ -157,12 +164,16 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
)
pkgsets[0].assert_has_calls(
[mock.call.populate("f25", 123456, inherit=True, include_packages=set())]
[
mock.call.populate(
"f25", event=123456, inherit=True, include_packages=set()
),
]
)
pkgsets[1].assert_has_calls(
[
mock.call.populate(
"f25-extra", 123456, inherit=True, include_packages=set()
"f25-extra", event=123456, inherit=True, include_packages=set()
),
]
)