Skip to content

Auto-verify artifact packages against require/recommend#4726

Merged
thrix merged 9 commits intomainfrom
vaibhav-verify-artifact-plugin
Apr 8, 2026
Merged

Auto-verify artifact packages against require/recommend#4726
thrix merged 9 commits intomainfrom
vaibhav-verify-artifact-plugin

Conversation

@vaibhavdaren
Copy link
Copy Markdown
Contributor

@vaibhavdaren vaibhavdaren commented Mar 20, 2026

When the artifact plugin is present with verify=True (default), a verify-installation phase is automatically injected at order=79. It intersects require/recommend packages for the current guest with packages listed in artifacts.yaml, and verifies that the overlapping packages were installed from the tmt-artifact-shared repository.

Related to #4646

@vaibhavdaren vaibhavdaren self-assigned this Mar 20, 2026
@vaibhavdaren vaibhavdaren 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 20, 2026
@github-project-automation github-project-automation bot moved this to backlog in planning Mar 20, 2026
@vaibhavdaren vaibhavdaren linked an issue Mar 20, 2026 that may be closed by this pull request
Copy link
Copy Markdown
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

The pull request introduces an automatic verification phase for artifact packages, ensuring that packages listed in require/recommend are installed from the tmt-artifact-shared repository when the artifact plugin is enabled with verify=True. This is a valuable addition for ensuring test environment integrity. The implementation correctly handles the intersection of artifact metadata and test requirements, and prioritizes explicit verify-installation configurations over auto-detected ones. The use of Final for constants in tmt/steps/prepare/artifact/__init__.py is a good practice.

Comment thread tmt/steps/prepare/__init__.py Outdated
Comment thread tmt/steps/prepare/__init__.py Outdated
Comment thread tmt/steps/prepare/__init__.py Outdated
Comment thread tmt/steps/prepare/verify_installation.py Outdated
@LecrisUT LecrisUT moved this from backlog to implement in planning Mar 23, 2026
@LecrisUT LecrisUT added this to the 1.70 milestone Mar 23, 2026
happz added a commit that referenced this pull request Mar 23, 2026
Queues are "burried" inside `go()` methods, but if we want to support
addition of new tasks from outside of the step, the queue needs to
become step-level instance attribute so it can be modified from outside
of `go()`.

Related to #4726
@happz happz mentioned this pull request Mar 23, 2026
1 task
happz added a commit that referenced this pull request Mar 23, 2026
Adding concept of ordering to queue tasks. Most of the time, tasks will
inherit their order from phases they represent. This will allow
reordering of queue after adding new tasks while the queue is already
running - today, the queue is sorted at the beginning, because steps
already add tasks in the order of phases they represent.

Related to #4726.
@happz happz mentioned this pull request Mar 23, 2026
2 tasks
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Set 'verify: false' on the artifact phase to opt out.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Remove unnecessary threading.Lock from PrepareArtifact
- Add schema and release note documentation
- Add unit and integration tests

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add unit tests for verify population and phase injection
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add unit tests for verify population and phase injection
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add unit tests for verify population and phase injection
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add unit tests for verify population and phase injection
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'auto_verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'auto_verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'auto_verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'auto_verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
@vaibhavdaren vaibhavdaren force-pushed the vaibhav-verify-artifact-plugin branch 2 times, most recently from 971462b to 3c77c8e Compare March 23, 2026 19:04
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'auto_verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'auto_verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
vaibhavdaren added a commit that referenced this pull request Mar 23, 2026
Add automatic verification of packages installed from artifact repositories
against test require/recommend and explicit prepare install phases. This
ensures packages were installed from the expected artifact sources rather
than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'auto_verify: false' on the
artifact phase.

Changes:
- Move auto-verify logic into artifact plugin for better cohesion
- Add _populate_verify_from_providers() to compute package intersections
- Add _inject_artifact_verify_phase() to auto-inject verification phase
- Add 'auto_verify' option to artifact schema (default: true)
- Add schema support for package-to-repo mapping in verify-installation
- Add integration tests for auto-verify and opt-out behavior
- Add release notes documentation

Fixes: #4726
@vaibhavdaren vaibhavdaren force-pushed the vaibhav-verify-artifact-plugin branch from 3c77c8e to 801cd29 Compare March 23, 2026 21:36
@vaibhavdaren
Copy link
Copy Markdown
Contributor Author

/packit retest-failed

@vaibhavdaren vaibhavdaren force-pushed the vaibhav-verify-artifact-plugin branch from b5a717d to 4734a84 Compare April 3, 2026 00:00
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Comment thread tmt/steps/prepare/artifact/__init__.py
Comment thread tmt/steps/prepare/artifact/__init__.py
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Comment thread tests/prepare/verify-installation/test.sh
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Copy link
Copy Markdown
Member

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

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

LGTM, other than my unresolved comments

Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Comment thread tmt/steps/prepare/artifact/__init__.py
Comment thread tmt/steps/prepare/artifact/__init__.py
Copy link
Copy Markdown
Member

@psss psss left a comment

Choose a reason for hiding this comment

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

One simplification suggestion for the test and failing repository-file scenario.

Comment thread tests/prepare/artifact/verify-installation/data/main.fmf Outdated
Comment thread tmt/steps/prepare/artifact/__init__.py
Comment thread tmt/steps/prepare/verify_installation.py
@thrix
Copy link
Copy Markdown
Contributor

thrix commented Apr 8, 2026

/packit retest-failed

@vaibhavdaren
Copy link
Copy Markdown
Contributor Author

All the tests passed :) ^_^. Rebasing for the final merge

Integrate artifact verification into the prepare artifact plugin. When
verify=True (the default), packages installed from artifact repositories
are automatically verified against test require/recommend and explicit
prepare install phases. This ensures packages were installed from the
expected artifact sources rather than from default system repositories.

The verification runs as an auto-injected verify-installation phase that
computes the intersection of artifact package names and test dependencies.
Each artifact phase populates the shared verify phase with packages from
its own providers. Tests can opt-out by setting 'verify: false' on the
artifact phase.

Key implementation details:
- Auto-verify injection happens in PrepareArtifact.go() using the new
  step-add-phase-to-queue infrastructure (self.step.add_phase())
- Verify phase is dynamically added to the running queue
- Multiple artifact phases with same where= group share one verify phase
- Package-to-repo mapping includes handling for both download providers
  (koji.build, copr.build) and repository providers (repository-file, etc.)

Changes:
- Add 'verify' option to artifact schema (default: true)
- Add PrepareArtifact._inject_verify_phase() method
- Add schema support for package-to-repo mapping in verify-installation
- Add integration tests for auto-verify behavior
- Update existing verify-installation tests
- Add release notes documentation
@thrix thrix mentioned this pull request Apr 8, 2026
18 tasks
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: done

Development

Successfully merging this pull request may close these issues.

Link the verify install plugin to the artifact plugin

5 participants