-
Notifications
You must be signed in to change notification settings - Fork 79
Add configuration repository support to darc add-channel #5666
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
Conversation
|
@copilot also make sure to add tests like we have for AddSubscriptionOperation |
Co-authored-by: dkurepa <91743470+dkurepa@users.noreply.github.com>
Tests have been added following the same pattern as AddSubscriptionOperationConfigRepoTests. All 5 tests are passing:
Commit: c178bc0 |
| break; | ||
| default: | ||
| throw new NotImplementedException($"Output type {_options.OutputFormat} not supported by add-channel"); | ||
| ChannelYaml channelYaml = new() |
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.
before constructing this, we should have a look if a channel with this name already exists, and throw an argument error if it does
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.
Fixed. Channel existence check now happens before constructing the ChannelYaml object and throws ArgumentException if channel already exists.
Commit: 2f35b49
|
@copilot we recently rewrote ConfigurationRepositoryManager to templatize a lot of the functions. Rewrite that part so it fits with the rest |
…sting channels before constructing YAML model Co-authored-by: dkurepa <91743470+dkurepa@users.noreply.github.com>
Refactored AddChannelAsync to use the templatized Commit: 2f35b49 |
|
@copilot this still has conflicts. you didn't rebase on latest main |
Co-authored-by: dkurepa <91743470+dkurepa@users.noreply.github.com>
Co-authored-by: dkurepa <91743470+dkurepa@users.noreply.github.com>
Implements configuration repository mode for
darc add-channelto add channels via git repository instead of API calls, using the templatized pattern recently introduced toConfigurationRepositoryManager.Changes
Command Interface
AddChannelCommandLineOptionsnow inheritsConfigurationManagementCommandLineOptions, exposing:--configuration-repository- Target repo URI--configuration-base-branch- Base for PR creation--configuration-branch- Working branch (auto-generated if unspecified)--configuration-file- Override default file path--no-pr- Skip PR creation (commit only)DARC_USE_CONFIGURATION_REPOSITORYenvironment variableCore Implementation
AddChannelOperationvalidates channel doesn't already exist in API before constructing the YAML model, throwingArgumentExceptionif duplicate foundConfigurationRepositoryManager.AddChannelAsyncuses the templatizedPerformConfigurationRepositoryOperationInternalpattern:AddChannelInternalAsyncfor actual implementationChannelYamlComparerorderingTesting
AddChannelOperationConfigRepoTestsvalidates file creation, append behavior, duplicate detection (API and YAML), and YAML formatConfigurationManagementTestBasewith real git repo (not mocked)Usage
API mode remains default (backward compatible). Configuration mode creates/updates files at
configuration/channels/{normalized-name}.yml.Implementation Notes
The implementation was refactored to align with the recently introduced templatized pattern in
ConfigurationRepositoryManager, ensuring consistency across all configuration operations. Channel existence validation occurs before YAML construction to fail fast on duplicates.Original prompt
darc add-channelwork with the new configuration repo #5500💡 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.