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

Fix pub ecosystem Flutter dependency_services execution by applying --force checkout #11762

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kbukum1
Copy link
Contributor

@kbukum1 kbukum1 commented Mar 7, 2025

What are you trying to accomplish?

This PR fixes an issue where dependency_services execution was failing due to uncommitted changes in bin/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?

How will you know you've accomplished your goal?

  • Local testing shows that the previously failing repository now works correctly.
  • The Draft PR will validate whether this fix applies broadly.
  • No unexpected side effects should occur when running Dependabot updates.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@github-actions github-actions bot added the L: dart:pub Dart packages via pub label Mar 7, 2025
@kbukum1 kbukum1 force-pushed the kamil/fix-pub-ecosystem-running-dependency-services-issue branch from a2a9073 to aa0c034 Compare March 7, 2025 20:48
@kbukum1 kbukum1 force-pushed the kamil/fix-pub-ecosystem-running-dependency-services-issue branch from b507dc4 to b397b9f Compare March 7, 2025 22:58
@kbukum1 kbukum1 changed the title Fix pub ecosystem running flutter dependency_services execution directory Fix pub ecosystem Flutter dependency_services execution by applying --force checkout Mar 7, 2025
@kbukum1 kbukum1 marked this pull request as ready for review March 7, 2025 23:02
@kbukum1 kbukum1 requested a review from a team as a code owner March 7, 2025 23:02
if File.directory?("/tmp/flutter/.git")
Dependabot.logger.info "Flutter repo already exists at /tmp/flutter."
return
end
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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,
Copy link
Contributor Author

@kbukum1 kbukum1 Mar 7, 2025

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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}"

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dart:pub Dart packages via pub
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants