Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for plugin index #6674

Merged
merged 26 commits into from
May 14, 2024

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented May 13, 2024

Description

This PR adds support for the plugin index. See #6641 for more details.

Usage

  1. Download the plugin list:
$ trivy plugin update
  1. Discover plugins available on the index:
$ trivy plugin search
NAME                 DESCRIPTION                                                  MAINTAINER           OUTPUT
aqua                 A plugin for integration with Aqua Security SaaS platform    aquasecurity
kubectl              A plugin scanning the images of a kubernetes resource        aquasecurity
referrer             A plugin for OCI referrers                                   aquasecurity           ✓
[...]
  1. Choose a plugin from the list and install it:
$ trivy plugin install referrer
  1. Use the installed plugin:
$ trivy referrer --help
  1. Keep your plugins up-to-date:
$ trivy plugin upgrade
  1. Uninstall a plugin you no longer use:
trivy plugin uninstall referrer

Schema update

This PR also adds changes to plugin.yaml.

  • Rename usage to summary for clarity
    • Trivy also recognizes usage for backward compatibility.
  • Add maintainer

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@knqyf263 knqyf263 self-assigned this May 13, 2024
@knqyf263 knqyf263 requested a review from DmitriyLewen May 13, 2024 04:49
@knqyf263
Copy link
Collaborator Author

@DmitriyLewen I'm still writing a developer guide, but the implementation has been completed. I would appreciate your quick feedback.

@knqyf263 knqyf263 force-pushed the feat/plugin_index branch from 4ae9241 to a7c71fa Compare May 13, 2024 06:21
Copy link
Contributor

@DmitriyLewen DmitriyLewen left a comment

Choose a reason for hiding this comment

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

Left some comments.

Also prefix log is broken:

➜  ./trivy plugin install aqua
2024/05/13 12:40:43 INFO Installing the plugin... prefix="[plugin] " src=github.com/aquasecurity/trivy-plugin-aqua

pkg/commands/app.go Show resolved Hide resolved
pkg/commands/app.go Outdated Show resolved Hide resolved
docs/docs/plugin/user-guide.md Outdated Show resolved Hide resolved
docs/docs/plugin/user-guide.md Show resolved Hide resolved
pkg/commands/app.go Show resolved Hide resolved
pkg/commands/app.go Outdated Show resolved Hide resolved
pkg/plugin/manager.go Outdated Show resolved Hide resolved
@DmitriyLewen
Copy link
Contributor

1 more thought:
perhaps we want to add information that the plugin was installed successfully?

Currently:

➜  trivy git:(feat/plugin_index) ✗ ./trivy plugin install kubectl
2024/05/13 12:57:56 INFO Installing the plugin... prefix="[plugin] " src=github.com/aquasecurity/trivy-plugin-kubectl

@knqyf263
Copy link
Collaborator Author

Also prefix log is broken:

Thanks. It worked at the beginning, and got broken after refactoring. Fixed in 9dbecdf

@knqyf263 knqyf263 marked this pull request as ready for review May 13, 2024 10:51
@knqyf263 knqyf263 requested a review from DmitriyLewen May 13, 2024 10:51
@knqyf263
Copy link
Collaborator Author

perhaps we want to add information that the plugin was installed successfully?

Done
466b9f5

@knqyf263
Copy link
Collaborator Author

@DmitriyLewen I've addressed your comments and completed the developer guide. This PR is now ready for review.

pkg/plugin/manager.go Outdated Show resolved Hide resolved
pkg/commands/app.go Show resolved Hide resolved
pkg/plugin/manager.go Outdated Show resolved Hide resolved
docs/docs/plugin/index.md Outdated Show resolved Hide resolved
docs/docs/plugin/user-guide.md Outdated Show resolved Hide resolved
@knqyf263 knqyf263 requested a review from DmitriyLewen May 14, 2024 06:16
Copy link
Contributor

@DmitriyLewen DmitriyLewen left a comment

Choose a reason for hiding this comment

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

LGTM

@knqyf263 knqyf263 force-pushed the feat/plugin_index branch from 6e0163e to 7fae791 Compare May 14, 2024 07:18
@knqyf263 knqyf263 added this pull request to the merge queue May 14, 2024
Merged via the queue into aquasecurity:main with commit 26faf8f May 14, 2024
17 checks passed
@knqyf263 knqyf263 deleted the feat/plugin_index branch May 14, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: plugin Index
2 participants