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

Pluginmanager install preserve #17267

Merged
merged 2 commits into from
Mar 6, 2025

Conversation

yaauie
Copy link
Member

@yaauie yaauie commented Mar 5, 2025

Release notes

[rn:skip]

What does this PR do?

Fixes a regression introduced in #17203 that caused the bin/logstash-plugin install --preserve flag to not preserve.

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

  • When a plugin is installed with --version, the Gemfile is amended to add the plugin and its version requirement.
  • When this version requirement is present, installing it again with the --preserve flag should preserve the requirement.
  • A fix to allow plugins installed with --version to be upgraded had the side-effect of making the install command's --preserve not work.

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

How to test this PR locally

This PR comes with tests and a fix separately. The tests can be used to verify the pre-broken behaviour as so:

  1. check out the branch
  2. revert the fixing commit and observe test failures:
    back-out the portion of the breaking commit
    git revert --no-commit HEAD
    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 8c969138073b98de7a99daf3c62527e5758711f9^! -- lib/pluginmanager/gemfile.rb | patch --strip 1 --reverse
    ci/integration_tests.sh specs/cli/install_spec.rb
    

@yaauie yaauie requested a review from donoghuc March 5, 2025 23:51
Copy link

mergify bot commented Mar 5, 2025

This pull request does not have a backport label. Could you fix it @yaauie? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • backport-8.x is the label to automatically backport to the 8.x branch.

Copy link

mergify bot commented Mar 5, 2025

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Mar 5, 2025
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

Copy link
Member

@donoghuc donoghuc left a comment

Choose a reason for hiding this comment

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

This makes sense, the test coverage is nice. Explicitly encoding in rspec what is happening with the behavior when not using --preserve is helpful.

@yaauie yaauie merged commit a736178 into elastic:main Mar 6, 2025
10 checks passed
@yaauie yaauie removed the backport-8.x Automated backport to the 8.x branch with mergify label Mar 6, 2025
Copy link

mergify bot commented Mar 6, 2025

This pull request does not have a backport label. Could you fix it @yaauie? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • backport-8.x is the label to automatically backport to the 8.x branch.

Copy link

mergify bot commented Mar 6, 2025

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Mar 6, 2025
mergify bot pushed a commit that referenced this pull request Mar 6, 2025
* tests: integration tests for pluginmanager install --preserve

* fix regression where pluginmanager's install --preserve flag didn't

(cherry picked from commit a736178)

# Conflicts:
#	qa/integration/specs/cli/install_spec.rb
#	qa/integration/specs/cli/pluginmanager_spec_helper.rb
yaauie added a commit to yaauie/logstash that referenced this pull request Mar 6, 2025
* tests: integration tests for pluginmanager install --preserve

* fix regression where pluginmanager's install --preserve flag didn't
yaauie added a commit to yaauie/logstash that referenced this pull request Mar 6, 2025
* tests: integration tests for pluginmanager install --preserve

* fix regression where pluginmanager's install --preserve flag didn't
yaauie added a commit to yaauie/logstash that referenced this pull request Mar 6, 2025
* tests: integration tests for pluginmanager install --preserve

* fix regression where pluginmanager's install --preserve flag didn't
donoghuc pushed a commit that referenced this pull request Mar 6, 2025
* Pluginmanager clean after mutate (#17203)

* pluginmanager: always clean after mutate

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

* pr feedback

(cherry picked from commit 8c96913)

* Pluginmanager install preserve (#17267)

* tests: integration tests for pluginmanager install --preserve

* fix regression where pluginmanager's install --preserve flag didn't
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants