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

Backport 17203 and 17267 fedramp8x #17271

Open
wants to merge 3 commits into
base: feature/fedramp-high-8.x
Choose a base branch
from

Conversation

yaauie
Copy link
Member

@yaauie yaauie commented Mar 6, 2025

Release notes

From #17203:

  • 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?

Combined backports of #17203 and #17267 to feature/fedramp-high-8.x

#17203 includes a regression to the behavior of bin/logstash-plugin install's --preserve flag, which was addressed in #17267.

CONFLICTS: :skip_fips flags were added

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

From #17203:

  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
    

From #17267 (edited to be relevant to this PR):

  1. check out the branch
  2. revert the fixing [behavior] and observe test failures:
    back-out the portion of the breaking commit
    git diff eac157aac1003bb3694c783727b1859cb4a93583^! -- lib/pluginmanager/install.rb | patch --strip 1 --reverse
    ci/integration_tests.sh specs/cli/install_spec.rb
    
  3. revert the portion of Pluginmanager clean after mutate #17203 that caused the regression, and observe that tests pass:
    git diff 7d813cba7ace963a0e0a43488412ea2d756113e4^! -- lib/pluginmanager/gemfile.rb | patch --strip 1 --reverse
    ci/integration_tests.sh specs/cli/install_spec.rb
    

yaauie added 2 commits March 6, 2025 05:48
* pluginmanager: always clean after mutate

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

* pr feedback

(cherry picked from commit 8c96913)
* tests: integration tests for pluginmanager install --preserve

* fix regression where pluginmanager's install --preserve flag didn't
@yaauie yaauie requested a review from donoghuc March 6, 2025 05:52
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New 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

History

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