-
Notifications
You must be signed in to change notification settings - Fork 80
Add darc vmr add-repo and remove-repo commands #5415
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: premun <[email protected]>
Co-authored-by: premun <[email protected]>
Co-authored-by: premun <[email protected]>
| [Option("tpn-template", Required = false, HelpText = "Path to a template for generating VMRs THIRD-PARTY-NOTICES file. Leave empty to skip generation.")] | ||
| public string TpnTemplate { get; set; } | ||
|
|
||
| [Option("generate-codeowners", Required = false, HelpText = "Generate a common CODEOWNERS file for all repositories.")] | ||
| public bool GenerateCodeowners { get; set; } = false; | ||
|
|
||
| [Option("generate-credscansuppressions", Required = false, HelpText = "Generate a common .config/CredScanSuppressions.json file for all repositories.")] | ||
| public bool GenerateCredScanSuppressions { get; set; } = false; |
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.
@copilot remove these. The settings should be hardcoded to:
- TpnTemplate to
VmrInfo.ThirdPartyNoticesFileName GenerateCodeownerstofalseGenerateCredScanSuppressionstotrue
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.
Same for the removal command
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.
Done. Removed all optional parameters and hardcoded the settings as requested. (2603e44)
| [Option("additional-remotes", Required = false, HelpText = | ||
| "List of additional remote URIs to add to mappings in the format [mapping name]:[remote URI]. " + | ||
| "Example: installer:https://github.com/myfork/installer sdk:/local/path/to/sdk")] | ||
| [RedactFromLogging] | ||
| public IEnumerable<string> AdditionalRemotes { get; set; } |
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.
@copilot remove this one
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.
Done. Removed additional-remotes option. (2603e44)
| [Option("source-mappings", Required = true, HelpText = $"A path to the {VmrInfo.SourceMappingsFileName} file to be used for syncing.")] | ||
| public string SourceMappings { get; set; } |
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.
@copilot this one, the default path from VmrInfo should be used
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.
Done. Removed source-mappings option and now using default path from VmrInfo. (2603e44)
| [Option("additional-remotes", Required = false, Hidden = true)] | ||
| [RedactFromLogging] | ||
| public IEnumerable<string> AdditionalRemotes { get; set; } |
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.
@copilot remove this one
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.
Done. Removed additional-remotes option. (2603e44)
| private async Task RegenerateThirdPartyNoticesAsync(string templatePath, CancellationToken cancellationToken) | ||
| { | ||
| _logger.LogInformation("Regenerating third-party notices"); | ||
| await _thirdPartyNoticesGenerator.UpdateThirdPartyNotices(templatePath); | ||
| await _localGitClient.StageAsync(_vmrInfo.VmrPath, new[] { VmrInfo.ThirdPartyNoticesFileName }, cancellationToken); | ||
| } | ||
|
|
||
| private async Task RegenerateCodeownersAsync(CancellationToken cancellationToken) | ||
| { | ||
| _logger.LogInformation("Regenerating CODEOWNERS"); | ||
| await _codeownersGenerator.UpdateCodeowners(cancellationToken); | ||
| } | ||
|
|
||
| private async Task RegenerateCredScanSuppressionsAsync(CancellationToken cancellationToken) | ||
| { | ||
| _logger.LogInformation("Regenerating credential scan suppressions"); | ||
| await _credScanSuppressionsGenerator.UpdateCredScanSuppressions(cancellationToken); | ||
| } |
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.
@copilot Do not define these as methods but call them directly and remove the logging which is inside of the methods (or should be).
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.
Done. Inlined all three methods and removed the extra logging. (2603e44)
| private string PrepareCommitMessage(string template, string repoName) | ||
| { | ||
| return template.Replace("{name}", repoName); | ||
| } |
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.
@copilot Inline this 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.
Done. Inlined PrepareCommitMessage. (2603e44)
Co-authored-by: premun <[email protected]>
Adds explicit commands for adding/removing repositories from the VMR. Previously, users had to use the less discoverable
initializecommand for additions, and removal required manual manipulation of VMR files.Changes
New Commands:
darc vmr add-repo- Aliases existingIVmrInitializerfunctionality for better discoverabilitydarc vmr remove-repo- New command that removes repos from VMRImplementation:
IVmrRemoverinterface andVmrRemoverimplementation extendingVmrManagerBaseTHIRD-PARTY-NOTICES.txt, GenerateCodeowners =false, GenerateCredScanSuppressions =trueadd-repouses default source-mappings path fromVmrInfo.DefaultRelativeSourceMappingsPathUsage:
The
initializecommand remains for backward compatibility.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.