-
Notifications
You must be signed in to change notification settings - Fork 23
fix: Fix registries deletion when adding new ecosystems to dependabot.yml #378
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
@copilot can you fix the failing github actions. You may need to use the |
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
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.
Pull Request Overview
This PR fixes a bug where evergreen was incorrectly deleting existing registry configurations when adding new package ecosystems to an existing dependabot.yml
file. The issue occurred because the make_dependabot_config()
function unconditionally removed registries when no extra configuration was provided.
- Removed the problematic code that was deleting registries when
extra_dependabot_config
was None - Fixed the default data structure to avoid adding empty registries sections
- Added comprehensive test coverage for the registry preservation scenario
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
dependabot_file.py | Removed the line causing registry deletion and empty registries from default structure |
test_dependabot_file.py | Added regression test to ensure existing registries are preserved when new ecosystems are added |
Problem
When evergreen adds new package ecosystems to an existing
dependabot.yml
file, it was incorrectly deleting any existing top-levelregistries:
section. This happened because themake_dependabot_config()
function unconditionally removed registries when noextra_dependabot_config
was provided.Example Issue
Given an existing
dependabot.yml
with registries:When evergreen detected a new ecosystem (e.g., gradle) and added it, the
registries:
section was deleted, resulting in:Solution
Removed problematic code: Deleted the line
dependabot_config.pop("registries", None)
frommake_dependabot_config()
that was unconditionally removing registries whenextra_dependabot_config
was None.Fixed default data structure: Removed the empty
registries: {}
from the default data structure to avoid adding empty registries sections when not needed.Added regression test: Created
test_build_dependabot_file_preserves_existing_registries
to ensure existing registries are preserved when new ecosystems are added.Result
Now existing registries configurations are properly preserved when evergreen adds new package ecosystems:
Testing
Fixes #377.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.