Skip to content

Pluginmanager clean after mutate (backport #17203)#17221

Closed
mergify[bot] wants to merge 1 commit into9.0from
mergify/bp/9.0/pr-17203
Closed

Pluginmanager clean after mutate (backport #17203)#17221
mergify[bot] wants to merge 1 commit into9.0from
mergify/bp/9.0/pr-17203

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Mar 4, 2025

Release notes

  • FIX: The plugin manager now correctly cleans up plugins and gem dependencies that are no longer needed after invoking install, remove, or update.
  • FIX: The plugin manager's update command no longer fails to upgrade plugins that were initially installed with --version flag

What does this PR do?

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

  • For users who update, install, or remove plugins, cleaning out deactivated dependencies can reduce the disk footprint of the logstash installation
  • For building Logstash artifacts, this 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

Author's Checklist

  • [ ]

How to test this PR locally

Likely the easiest is to install, remove, or update plugins, observe the output, and check how the vendor/bundle was changed:

  1. Installing a plugin should remove overwritten plugins and orphaned dependencies
    find vendor/bundle/jruby/*/* -depth 1 | sort > vendor_snapshot.txt
    bin/logstash-plugin install --version 4.1.2 logstash-output-email
    find vendor/bundle/jruby/*/* -depth 1 | sort > vendor_compare.txt
    diff -u vendor_snapshot.txt vendor_compare.txt
    
  2. Updating a plugin should remove the previous version (and its shared dependencies)
    bin/logstash-plugin install --version 4.1.2 logstash-output-email
    find vendor/bundle/jruby/*/* -depth 1 | sort > vendor_snapshot.txt
    bin/logstash-plugin update logstash-output-email
    find vendor/bundle/jruby/*/* -depth 1 | sort > vendor_compare.txt
    diff -u vendor_snapshot.txt vendor_compare.txt
    
  3. Removing a plugin should remove the plugin gem and its unshared dependencies:
    find vendor/bundle/jruby/*/* -depth 1 | sort > vendor_snapshot.txt
    bin/logstash-plugin remove logstash-integration-aws
    find vendor/bundle/jruby/*/* -depth 1 | sort > vendor_compare.txt
    diff -u vendor_snapshot.txt vendor_compare.txt
    

Related issues


This is an automatic backport of pull request #17203 done by [Mergify](https://mergify.com).

* pluginmanager: always clean after mutate

* pluginmanager: don't skip updating plugins installed with --version

* pr feedback

(cherry picked from commit 8c96913)
@mergify mergify bot mentioned this pull request Mar 4, 2025
4 tasks
@elastic-sonarqube
Copy link
Copy Markdown

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
Copy Markdown

💚 Build Succeeded

@donoghuc
Copy link
Copy Markdown
Member

donoghuc commented Mar 6, 2025

Closing in favor of #17269

@donoghuc donoghuc closed this Mar 6, 2025
@jsvd jsvd deleted the mergify/bp/9.0/pr-17203 branch September 1, 2025 11:20
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.

3 participants