-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove Bundler v1 Code and Related Feature Flags #10775
Conversation
I think we should rename the v2 folder too but that can be a follow up PR |
Do we have plans for smoke tests removal and all that too? |
@@ -11,7 +11,7 @@ function print_usage() { | |||
function handle_args() { | |||
export SUITE_NAME=$1 | |||
case $SUITE_NAME in | |||
bundler1 | bundler2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need the "in" check or can we simplify some more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep that since in future we may also add bundler v3 in case. I tried to keep the syntax of supporting multiple as it is just currently we have one version, v2 now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's okay to keep it, I also suspect realistically bundler v3 is very unlikely to ship for a long, long time... if so, it might be simpler to just streamline entirely to remove confusion for developers who wonder "why is this?"... at the very least you'd want a code comment of:
in
used here in case bundler v3 ever ships...
btw, @deivid-rodriguez any input on how long it might be til we see bundler v3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition is removed and it is simplified.
@@ -35,9 +35,6 @@ def deprecated? | |||
|
|||
sig { override.returns(T::Boolean) } | |||
def unsupported? | |||
# Check if the feature flag for Bundler v1 unsupported error is enabled. | |||
return false unless Dependabot::Experiments.enabled?(:bundler_v1_unsupported_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make sure to remove the flag everywhere too :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, actually I am removing from everywhere and not only unsupported but deprecation flag as well. We are done now checking last issues. After core is done, I will also remove them feature flags from dependabot-api
as well.
add_deprecation_warn_to_pr_message
bundler_v1_unsupported_error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is created to remove from dependabot-api.
PR: dependabot-api#5816
…e forcefully since unsupported takes over deprecation.
I think we don't need to do anything on smoke tests but I need to check later. We have simple removal job on dependabot-api for feature flags. |
21290bf
to
caab60b
Compare
else | ||
Dependabot.logger.info("Nothing to update for Dependency Group: '#{group.name}'") | ||
end | ||
|
||
dependency_change | ||
rescue ToolVersionNotSupported => e | ||
error_handler.handle_job_error(error: e, dependency_group: group) | ||
nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for any package manager, we are going to stop the group update and handle not supported error.
if target_dependencies.empty? | ||
record_security_update_dependency_not_found | ||
else | ||
target_dependencies.each { |dep| check_and_create_pr_with_error_handling(dep) } | ||
end | ||
rescue StandardError => e | ||
error_handler.handle_dependency_error(error: e, dependency: target_dependencies&.first) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for the package manager, we don't want to go over each dependency, instead we want to raise unsupported error for the whole process and handle error properly.
sig { params(group: Dependabot::DependencyGroup).returns(T.nilable(Dependabot::DependencyChange)) } | ||
def compile_all_dependency_changes_for(group) | ||
prepare_workspace | ||
|
||
# Raise an error if the package manager version is unsupported | ||
dependency_snapshot.package_manager&.raise_if_unsupported! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error for any package manager in the group, we are going to raise error before stating update process.
@@ -118,6 +118,8 @@ def perform # rubocop:disable Metrics/AbcSize | |||
|
|||
upsert_pull_request_with_error_handling(T.must(dependency_change), job_group) | |||
end | |||
rescue ToolVersionNotSupported => e | |||
error_handler.handle_job_error(error: e, dependency_group: job_group) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for any package manager, we are going to stop the group update and handle not supported error.
# Retrieve the list of initial notices from dependency snapshot | ||
@notices = dependency_snapshot.notices | ||
# More notices can be added during the update process | ||
|
||
dependencies.each { |dep| check_and_create_pr_with_error_handling(dep) } | ||
rescue StandardError => e | ||
error_handler.handle_dependency_error(error: e, dependency: dependencies.last) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for the package manager, we don't want to go over each dependency, instead we want to raise unsupported error for the whole process and handle error properly.
@@ -52,11 +52,16 @@ def perform | |||
Dependabot.logger.info("Starting update job for #{job.source.repo}") | |||
Dependabot.logger.info("Checking all dependencies for version updates...") | |||
|
|||
# Raise an error if the package manager version is unsupported | |||
dependency_snapshot.package_manager&.raise_if_unsupported! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for the package manager, we don't want to go over each dependency, instead we want to raise unsupported error for the whole process and handle error properly.
target_dependencies = dependency_snapshot.job_dependencies | ||
|
||
# Raise an error if the package manager version is unsupported | ||
dependency_snapshot.package_manager&.raise_if_unsupported! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for the package manager, we don't want to go over each dependency, instead we want to raise unsupported error for the whole process and handle error properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be simpler to not modify these operations, and have DependencySnapshot::dependency_file_parser
raise an error right when we calculate the "package_manager".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is we are not catching errors on top of the operations. So when I do that I also need to error handling. I will check the feasibility of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it ok to do that after cleaning-up the code. I think this will also need some tests and also after adding it to the DependencySnapshot::dependency_file_parser
I need check error handling mechanism for this code the place where is called and handle error properly. Otherwise it is turning to unknown error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for posterity I raised a PR #10794 which is what I was suggesting.
dependency = dependencies.last | ||
|
||
# Raise an error if the package manager version is unsupported | ||
dependency_snapshot.package_manager&.raise_if_unsupported! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have unsupported error
for the package manager, we don't want to go over each dependency, instead we want to raise unsupported error for the whole process and handle error properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
Thank you for your support and feedback! |
9c056ff
to
b78c977
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is difficult to review as it's doing two things:
- Adding support for deprecating an ecosystem to the updater code
- Deprecating and deleting bundler v1
target_dependencies = dependency_snapshot.job_dependencies | ||
|
||
# Raise an error if the package manager version is unsupported | ||
dependency_snapshot.package_manager&.raise_if_unsupported! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be simpler to not modify these operations, and have DependencySnapshot::dependency_file_parser
raise an error right when we calculate the "package_manager".
We are splitting PR in multiple PRs. We created a new PR for moving unsupporting error at the top of update operations. |
This PR is splitted into 3 PRs |
What are you trying to accomplish?
This PR removes all Bundler v1-specific code and deprecation feature flags (
add_deprecation_warn_to_pr_message
andbundler_v1_unsupported_error
) as part of deprecating support for Bundler v1. This cleanup ensures that Dependabot exclusively supports Bundler v2 and higher versions moving forward, aligning with recent changes to our package manager structure.Anything you want to highlight for special attention from reviewers?
Given the scope of changes, particularly removing legacy Bundler v1 feature flags and related code, this update may impact areas previously conditional on Bundler version checks. I chose to remove the v1-related code and feature flags in favor of a streamlined v2-only approach to simplify the codebase and prevent potential misconfigurations.
When reviewing this PR, please note that although there are changes in over 379 files, the substantial updates are limited to around 60 files. There's no need to go through each file in the following folders, as we are entirely removing Bundler v1 and have comprehensive tests in place for Bundler v2 functionality:
bundler/helpers/v1
bundler/spec/fixtures/projects/bundler1
How will you know you've accomplished your goal?
Checklist