Skip to content

Extract shared discover plugin logic into the step#4391

Merged
thrix merged 10 commits intomainfrom
fvagner-discover-refactor
Jan 14, 2026
Merged

Extract shared discover plugin logic into the step#4391
thrix merged 10 commits intomainfrom
fvagner-discover-refactor

Conversation

@therazix
Copy link
Contributor

@therazix therazix commented Dec 2, 2025

This PR extracts some shared behavior (repository fetching, installation of libraries, and application of policies) from individual discover plugins to their parent Discover plugin. The discover step now has control over these individual actions and can, for example, choose when exactly to perform repository fetching and other actions. It also makes some behavior consistent between the two discover plugins. The discover/shell plugin now gains the url-content-type key, which works the same way as in the discover/fmf plugin. Remote repository fetching is now unified for both plugins.

Resolves #4348

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@therazix therazix added this to the 1.63 milestone Dec 2, 2025
@therazix therazix added this to planning Dec 2, 2025
@therazix therazix added step | discover Stuff related to the discover step plugin | fmf The fmf discover plugin plugin | shell The shell discover plugin labels Dec 2, 2025
@github-project-automation github-project-automation bot moved this to backlog in planning Dec 2, 2025
@therazix therazix added the area | maintenance Changes important for efficiency and the long-term health of the project label Dec 2, 2025
@therazix therazix moved this from backlog to implement in planning Dec 2, 2025
@therazix therazix added the ci | full test Pull request is ready for the full test execution label Dec 2, 2025
@therazix therazix force-pushed the fvagner-discover-refactor branch from 00fdab0 to 8a53658 Compare December 2, 2025 08:58
@therazix therazix moved this from implement to review in planning Dec 2, 2025
@therazix therazix force-pushed the fvagner-discover-refactor branch 3 times, most recently from ff65754 to c4afbf3 Compare December 2, 2025 12:05
@tcornell-bus tcornell-bus self-requested a review December 2, 2025 19:55
@therazix therazix force-pushed the fvagner-discover-refactor branch from c4afbf3 to c026f69 Compare December 3, 2025 08:46
@LecrisUT LecrisUT self-assigned this Dec 3, 2025
@psss psss modified the milestones: 1.63, 1.64 Dec 4, 2025
@therazix therazix moved this from review to implement in planning Dec 5, 2025
@therazix therazix force-pushed the fvagner-discover-refactor branch 3 times, most recently from 30d793b to 4f5a2d6 Compare December 10, 2025 01:47
@LecrisUT LecrisUT assigned psss and tcornell-bus and unassigned psss Dec 10, 2025
@happz happz self-requested a review December 10, 2025 08:53
@therazix therazix force-pushed the fvagner-discover-refactor branch from 6b5508b to 562eaa0 Compare January 13, 2026 10:17
@thrix
Copy link
Contributor

thrix commented Jan 13, 2026

@therazix looks good, I just found one thing via Claude Code Opus 4.5 to review. Can you check on it please?

Nice catch, thanks! I completely missed the duplicate validation. It should be fixed in 562eaa0.

Ty, can we also add tests?

  1. Add test plan in tests/discover/libraries/data/plan.fmf

  /shell:
      summary: "Library installation with shell discover plugin"
      discover:
          how: shell
          tests:
            - name: /certificate-shell
              test: ./certificate.sh
              require:
                - library(openssl/certgen)

  2. Add test phase in tests/discover/libraries/test.sh

  Add this phase before the cleanup:

  rlPhaseStartTest "Shell discover plugin installs libraries"
      rlRun -s "$tmt shell"
      rlAssertGrep "Fetch library 'openssl/certgen'" $rlRun_LOG
  rlPhaseEnd

@thrix thrix requested review from happz and thrix January 13, 2026 10:41
Copy link
Contributor

@thrix thrix left a comment

Choose a reason for hiding this comment

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

LGTM after adding tests.

@LecrisUT
Copy link
Contributor

Ty, can we also add tests?

  1. Add test plan in tests/discover/libraries/data/plan.fmf

  /shell:
      summary: "Library installation with shell discover plugin"
      discover:
          how: shell
          tests:
            - name: /certificate-shell
              test: ./certificate.sh
              require:
                - library(openssl/certgen)

Would prefer to keep it similar to file.sh that is already there. It seems that that would require changes on #4427 also because I had an assumption in there which I should be able to relax, but we would need more coverage in /tests/libarires

@LecrisUT
Copy link
Contributor

@therazix do you have a tracker for unifying the rest of these options? I don't see why keep_git_metadata should be only in shell or why the dist_git_* are only in fmf. There is still a lot of other discrepancy that we need to deal with, but just tracking these discrepancies would be helpful.

@thrix
Copy link
Contributor

thrix commented Jan 13, 2026

@therazix do you have a tracker for unifying the rest of these options? I don't see why keep_git_metadata should be only in shell or why the dist_git_* are only in fmf. There is still a lot of other discrepancy that we need to deal with, but just tracking these discrepancies would be helpful.

In that case I would keep it for the next release with an issue

@therazix
Copy link
Contributor Author

Ty, can we also add tests?

I added a simple test that should cover the keep-git-metadata validation with a remote URL specified in 956203c.

@therazix
Copy link
Contributor Author

@therazix do you have a tracker for unifying the rest of these options? I don't see why keep_git_metadata should be only in shell or why the dist_git_* are only in fmf. There is still a lot of other discrepancy that we need to deal with, but just tracking these discrepancies would be helpful.

Not yet. I will create an issue that will track the remaining things to improve or refactor. This is the first step. The other things will be addressed in additional PRs.

@thrix thrix moved this from review to merge in planning Jan 13, 2026
Copy link
Collaborator

@skycastlelily skycastlelily left a comment

Choose a reason for hiding this comment

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

Other than the nitpick, LGTM

@therazix therazix force-pushed the fvagner-discover-refactor branch from 956203c to 46a3edf Compare January 14, 2026 09:59
@thrix thrix merged commit 07f111f into main Jan 14, 2026
26 of 27 checks passed
@thrix thrix deleted the fvagner-discover-refactor branch January 14, 2026 13:19
@github-project-automation github-project-automation bot moved this from merge to done in planning Jan 14, 2026
@thrix
Copy link
Contributor

thrix commented Jan 14, 2026

The test issue is a known flake with virtual tests, I will be filing an issue for them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area | maintenance Changes important for efficiency and the long-term health of the project ci | full test Pull request is ready for the full test execution plugin | fmf The fmf discover plugin plugin | shell The shell discover plugin step | discover Stuff related to the discover step

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

Refactor discover plugins

7 participants