-
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
Fix pub ecosystem Flutter dependency_services execution by applying --force
checkout
#11762
base: main
Are you sure you want to change the base?
Fix pub ecosystem Flutter dependency_services execution by applying --force
checkout
#11762
Conversation
a2a9073
to
aa0c034
Compare
b507dc4
to
b397b9f
Compare
pub
ecosystem running flutter dependency_services
execution directory--force
checkout
if File.directory?("/tmp/flutter/.git") | ||
Dependabot.logger.info "Flutter repo already exists at /tmp/flutter." | ||
return | ||
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.
Review Tip: Added logging to help for support
else | ||
Dependabot.logger.error "Cloning Flutter failed: #{stderr}" | ||
raise Dependabot::DependabotError, "Cloning Flutter failed: #{stderr}" | ||
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.
Review Tip: Added logging to help for support
unless status.success? | ||
Dependabot.logger.error "Fetching Flutter version failed: #{stderr}" | ||
raise Dependabot::DependabotError, "Fetching Flutter version #{ref} failed: #{stderr}" | ||
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.
Review Tip: Added logging to help for support
|
||
# Check out the right version in git. | ||
_, stderr, status = Open3.capture3( | ||
{}, | ||
"git", | ||
"checkout", | ||
"--force", | ||
ref, |
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.
Review Tip: This is actual change we are applying.
else | ||
Dependabot.logger.error "Checking out Flutter version failed: #{stderr}" | ||
raise Dependabot::DependabotError, "Checking out Flutter #{ref} failed: #{stderr}" | ||
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.
Review Tip: Added logging to help for support
unless status.success? | ||
Dependabot.logger.error "Error executing dependency_services: #{stderr}" | ||
raise_error(stderr) | ||
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.
Review Tip: Added logging to help for support
@@ -218,6 +235,8 @@ def run_flutter_version | |||
|
|||
def run_dependency_services(command, stdin_data: nil) | |||
SharedHelpers.in_a_temporary_directory do |temp_dir| | |||
Dependabot.logger.info "Running dependency_services in temporary directory: #{temp_dir}" | |||
|
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.
Review Tip: Added logging to help for support
What are you trying to accomplish?
This PR fixes an issue where
dependency_services
execution was failing due to uncommitted changes inbin/internal/engine.version
within the Flutter repo used by Dependabot. The error occurred when checking out a new Flutter version, as Git refused to overwrite local changes.To resolve this, we now apply
--force
when checking out the Flutter version, ensuring that the working directory is reset before switching versions.This fixes the issue where updates were failing locally and possibly affecting automated dependency updates.
Anything you want to highlight for special attention from reviewers?
The actual business logic change is highlighted below, while the other modifications are only improvements to support logs.https://github.com/dependabot/dependabot-core/pull/11762/files#diff-e7529ea532fe965f931719cfb7b78a2644ad3b2b69e9345c6de3b9a3bca8c317R151
The fix forces the checkout of the Flutter repository version, preventing conflicts caused by untracked or modified files.
While this ensures updates proceed successfully, reviewers should verify if
--force
has any unintended side effects.Local testing confirmed the issue is resolved, but additional validation on other failing repositories is needed.
How will you know you've accomplished your goal?
Checklist