Skip to content

List packages from repository providers in artifacts.yaml#4703

Open
AthreyVinay wants to merge 8 commits intoavinay-copr-repo-enumeratefrom
avinay-enumerate-artifacts
Open

List packages from repository providers in artifacts.yaml#4703
AthreyVinay wants to merge 8 commits intoavinay-copr-repo-enumeratefrom
avinay-enumerate-artifacts

Conversation

@AthreyVinay
Copy link
Member

resolves: #4645

@AthreyVinay AthreyVinay added this to the 1.70 milestone Mar 16, 2026
@AthreyVinay AthreyVinay added step | prepare Stuff related to the prepare step ci | full test Pull request is ready for the full test execution plugin | artifact Related to the `prepare/artifact` plugin. labels Mar 16, 2026
@github-project-automation github-project-automation bot moved this to backlog in planning Mar 16, 2026
@AthreyVinay AthreyVinay moved this from backlog to review in planning Mar 16, 2026
@AthreyVinay AthreyVinay changed the base branch from main to avinay-copr-repo-enumerate March 16, 2026 16:37
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and valuable refactoring for artifact providers, particularly for repository-based ones. Centralizing Copr-related logic into a base class and shared module is a great improvement for maintainability. The new approach of having providers yield Repository objects for centralized installation is a cleaner design. The core new feature, enumerating packages from repositories to populate artifacts.yaml, is well-implemented. I have one suggestion to improve the robustness and logging in the new enumerate_artifacts method.

@AthreyVinay AthreyVinay changed the title Save repository providers' metadata in artifacts.yaml List packages from repository providers in artifacts.yaml Mar 16, 2026
@AthreyVinay AthreyVinay force-pushed the avinay-copr-repo-enumerate branch 2 times, most recently from 8014c88 to d25eaaf Compare March 19, 2026 09:59
@AthreyVinay AthreyVinay force-pushed the avinay-copr-repo-enumerate branch from d25eaaf to 0a48c6b Compare March 19, 2026 22:03
@AthreyVinay AthreyVinay force-pushed the avinay-copr-repo-enumerate branch from 0a48c6b to ea55382 Compare March 20, 2026 11:28
@AthreyVinay AthreyVinay force-pushed the avinay-enumerate-artifacts branch from 2537914 to 4f186c0 Compare March 20, 2026 11:45
Comment on lines +102 to +107
nvr_epoch, sep, arch = nevra.rpartition('.')
if not sep:
raise ValueError(f"Cannot parse arch from NEVRA '{nevra}'.")
parts = nvr_epoch.rsplit('-', 2)
if len(parts) != 3:
raise ValueError(f"Cannot parse NVR from NEVRA '{nevra}'.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just rsplit(maxsplit) and expand the tuple. There is no expectation of this failing unless a non-nvr is provided.

But also this can be done in a single regex (?P<name>.*)-(?:(?P<epoch>\d+)\:)?(?P<version>.*)-(?P<release>.*)\.(?P<arch>.*). I know we have this regex 1-2 places already even.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept the explicit check to give a useful error message when dnf repoquery emits unexpected non-NEVRA lines. Will change it to a regex match check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: cf5cddd

Comment on lines 221 to 222
@abstractmethod
def artifacts(self) -> Sequence[ArtifactInfo]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, can make it non-abstract if you always provide a _artifacts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: cf5cddd

self.sanitized_id = tmt.utils.sanitize_name(raw_id, allow_slash=False)

self.id = self._extract_provider_id(raw_id)
self._artifacts: list[ArtifactInfo] = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add it to the class and document its intent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: cf5cddd

Comment on lines +325 to +331
def enumerate_artifacts(
self, guest: Guest
) -> None: # TODO: refactor this once the NEVRA parsing is centralized.
"""
Enumerate artifacts available from this provider after its repositories
have been installed on the guest.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a special handling when the artifacts are from tmt-shared-repo, otherwise all providers that write to it would overwrite each other.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies - do not clearly understand the concern here. Can you please elaborte?

logger=provider_logger,
)

self._detect_duplicate_nvras(provider, seen_nvras)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The position and usage of this is now questionable again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - this was raised in the design decision. Open to ideas :)

@AthreyVinay AthreyVinay force-pushed the avinay-copr-repo-enumerate branch from ea55382 to e076df0 Compare March 20, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution plugin | artifact Related to the `prepare/artifact` plugin. step | prepare Stuff related to the prepare step

Projects

Status: review

Development

Successfully merging this pull request may close these issues.

All providers should list the artifacts in artifacts.yaml

4 participants