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

plugins: add clean command to remove inactive plugins/dependencies #16998

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaauie
Copy link
Member

@yaauie yaauie commented Jan 30, 2025

Release notes

  • adds bin/logstash-plugin clean command to allow the plugin manager to prune orphaned dependencies

What does this PR do?

adds bin/logstash-plugin clean command to allow the plugin manager to prune orphaned dependencies

Why is it important/What is the impact to the user?

  • For users who update plugins, providing a way to clean out deactivated dependencies can reduce the disk footprint of the logstash installation
  • For building Logstash artifacts, a clean option allows us to build a true subset of the dependency graph after removing plugins that are not needed in a minimalized artifact

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works There are existing tests around LogStash::Bunder#invoke!(clean: true)

Author's Checklist

  • File follow-up to document after the asciidoc-freeze on main is lifted.

How to test this PR locally

  1. remove a plugin that has dependencies (like logstash-integration-aws)
    bin/logstash-plugin remove logstash-integration-aws
  2. run the plugin manger's clean command
    bin/logstash-plugin clean
  3. Observe that the orphaned plugin and dependencies are cleaned up and removed from vendor

Logs

╭─{ rye@perhaps:~/src/elastic/logstash@main (pluginmanager-clean-command ✘) }
╰─● bin/logstash-plugin remove logstash-integration-aws
Using system java: /Users/rye/.jenv/shims/java
Resolving dependencies......
Resolving dependencies......
Successfully removed logstash-integration-aws
[success (00:00:06)]

╭─{ rye@perhaps:~/src/elastic/logstash@main (pluginmanager-clean-command ✘) }
╰─● bin/logstash-plugin clean
Using system java: /Users/rye/.jenv/shims/java
cleaned inactive plugin logstash-integration-aws-7.1.8 (java)
cleaned inactive dependency aws-eventstream (1.3.0)
cleaned inactive dependency aws-partitions (1.1043.0)
cleaned inactive dependency aws-sdk-cloudfront (1.109.0)
cleaned inactive dependency aws-sdk-cloudwatch (1.109.0)
cleaned inactive dependency aws-sdk-core (3.217.0)
cleaned inactive dependency aws-sdk-kms (1.97.0)
cleaned inactive dependency aws-sdk-resourcegroups (1.77.0)
cleaned inactive dependency aws-sdk-s3 (1.179.0)
cleaned inactive dependency aws-sdk-sns (1.94.0)
cleaned inactive dependency aws-sdk-sqs (1.91.0)
cleaned inactive dependency aws-sigv4 (1.11.0)
cleaned inactive dependency jar-dependencies (0.4.1)
cleaned inactive dependency jmespath (1.6.2)
[success]

> ~~~
> ╭─{ rye@perhaps:~/src/elastic/logstash@main (pluginmanager-clean-command ✘) }
> ╰─● bin/logstash-plugin remove logstash-integration-aws
> Using system java: /Users/rye/.jenv/shims/java
> Resolving dependencies......
> Resolving dependencies......
> Successfully removed logstash-integration-aws
> [success (00:00:06)]
>
> ╭─{ rye@perhaps:~/src/elastic/logstash@main (pluginmanager-clean-command ✘) }
> ╰─● bin/logstash-plugin clean
> Using system java: /Users/rye/.jenv/shims/java
> cleaned inactive plugin logstash-integration-aws-7.1.8 (java)
> cleaned inactive dependency aws-eventstream (1.3.0)
> cleaned inactive dependency aws-partitions (1.1043.0)
> cleaned inactive dependency aws-sdk-cloudfront (1.109.0)
> cleaned inactive dependency aws-sdk-cloudwatch (1.109.0)
> cleaned inactive dependency aws-sdk-core (3.217.0)
> cleaned inactive dependency aws-sdk-kms (1.97.0)
> cleaned inactive dependency aws-sdk-resourcegroups (1.77.0)
> cleaned inactive dependency aws-sdk-s3 (1.179.0)
> cleaned inactive dependency aws-sdk-sns (1.94.0)
> cleaned inactive dependency aws-sdk-sqs (1.91.0)
> cleaned inactive dependency aws-sigv4 (1.11.0)
> cleaned inactive dependency jar-dependencies (0.4.1)
> cleaned inactive dependency jmespath (1.6.2)
> [success]
> ~~~
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

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.

2 participants