-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
Improve validation for TfsEndpoint PAT tokens and message #2368
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…it details ♻️ (TfsAuthenticationOptions): implement IValidateOptions for validation ♻️ (TfsEndpointOptions): refactor validation logic to use IValidateOptions ♻️ (TfsLanguageMapOptions): implement IValidateOptions for validation ♻️ (TfsWorkItemMigrationProcessorOptions): enhance validation logic Update the MigrationTools.xml documentation to reflect the latest branch and commit details, ensuring the documentation is current. Implement IValidateOptions in TfsAuthenticationOptions and TfsLanguageMapOptions to standardize and improve validation logic. Refactor TfsEndpointOptions to utilize the new validation methods, enhancing code maintainability and readability. Enhance validation logic in TfsWorkItemMigrationProcessorOptions to ensure required fields and conditions are met, improving robustness and error handling. ♻️ (EndpointRegistrationExtensions.cs): pass endpointName to InvokeValidator for better context 🐛 (Processor.cs): remove duplicate exception tracking to avoid redundant telemetry Passing the `endpointName` to `InvokeValidator` provides better context during validation, which can help in debugging and logging. Removing the duplicate `Telemetry.TrackException` call in `Processor.cs` prevents redundant telemetry data, ensuring cleaner logs and more accurate error tracking.
♻️ (TfsTeamProjectAuthentication): add validation for NetworkCredentials ✨ (NetworkCredentialsOptions): implement IValidateOptions for NetworkCredentials The documentation is updated to reflect the latest branch and commit details, ensuring accuracy. The TfsTeamProjectAuthentication class now includes validation for NetworkCredentials, improving error handling and robustness. The NetworkCredentials class implements IValidateOptions to provide a structured way to validate its properties, ensuring that Domain, UserName, and Password are not null or empty.
…ror messages to include documentation links Enhance error messages with links to relevant documentation for better user guidance. This helps users quickly find detailed instructions and reduces confusion when encountering errors.
nkdagility-actions-bot
bot
added
enhancement
documentation
This is an item for a Documentation enhancement
enhancement-modern
feature
labels
Sep 15, 2024
♻️ (ProcessorOptions): integrate validation logic into ProcessorOptions class ♻️ (TfsWorkItemMigrationProcessorOptions): remove redundant validator class 🔧 (ServiceCollectionExtensions): change validator registration to transient 🐛 (ConfigurationValidationException): fix property name and add constructor overload 🐛 (Processor): throw ConfigurationValidationException for missing endpoints Renaming endpoint keys in `configuration.json` improves clarity and consistency. Integrating validation logic directly into `ProcessorOptions` and `TfsWorkItemMigrationProcessorOptions` simplifies the codebase by removing redundant classes. Changing the validator registration to transient ensures a new instance is created each time, which is more appropriate for validation. Fixing the property name in `ConfigurationValidationException` and adding a constructor overload enhances error reporting. Finally, throwing `ConfigurationValidationException` for missing endpoints ensures proper error handling.
… separate validator class The validation logic is moved from `TfsWorkItemMigrationProcessorOptions` to a new class `TfsWorkItemMigrationProcessorOptionsValidator`. This change improves the single responsibility principle by separating the concerns of option definition and validation. It also enhances code maintainability and readability by isolating validation logic in its own class.
…or TfsWorkItemMigrationProcessorOptions validation The type registered for validating `TfsWorkItemMigrationProcessorOptions` is corrected from `TfsWorkItemMigrationProcessorOptions` to `TfsWorkItemMigrationProcessorOptionsValidator`. This ensures that the correct validation logic is applied, preventing potential runtime errors and improving the robustness of the service configuration.
📝 (MigrationTools.xml): update generated documentation with new commit details ✅ (TfsWorkItemMigrationProcessorTests.cs): add SourceName and TargetName to test validation ♻️ (Processor.cs): remove redundant Telemetry.TrackException call Updating the EndpointType in configuration.json to AzureDevOpsEndpoint reflects the current naming conventions and services used. The generated documentation in MigrationTools.xml is updated to reflect the latest commit details, ensuring accuracy. Adding SourceName and TargetName in the TfsWorkItemMigrationProcessorTests.cs improves the test coverage and validation accuracy. Removing the redundant Telemetry.TrackException call in Processor.cs simplifies the error handling and logging process.
…e type validation ✨ (TfsProcessor.cs): add ConfigurationValidationException for invalid endpoint types The Source and Target properties now include type validation to ensure they are of type TfsTeamProjectEndpoint. If the type is incorrect, a ConfigurationValidationException is thrown, providing a clear error message. This change improves robustness by preventing misconfigurations and ensuring that the endpoints are of the expected type.
Change EndpointType from AzureDevOpsEndpoint to TfsTeamProjectEndpoint for both Source and Target endpoints. This change is necessary to align with the updated endpoint configuration requirements and ensure compatibility with the TFS Team Project endpoints.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
This is an item for a Documentation enhancement
enhancement
enhancement-modern
feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Both @soodgautam and @nkofctg ran into issues with the
when you are migrating to Azure DevOps you MUST provide an PAT so that we can call the REST API for certain actions. For example, we would be unable to deal with a Work item Type change.
message!This was due to the
SourceName
and/orTargetName
on the Processor being set to null. The validator now checks for this!It now checks for:
SourceName
and/orTargetName
being SetSourceName
and/orTargetName
existingSourceName
and/orTargetName
of correct type