Extract Contacts
class + related refactorings to NotificationConfigurator
class.
#5214
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.
Changes made
This PR improves logged messages and refactors
NotificationConfigurator
class logic related to obtaining list of contacts to send notifications to based on CODEOWNERS file from repository to which given pipeline pertains.The main change is extraction of
Contacts
class fromNotificationConfigurator
class, with entry method beingContacts.GetFromBuildDefinitionRepoCodeowners(BuildDefinition buildDefinition)
.I also made related improvements to log messages and naming in surrounding code. Most notably, I made the naming more consistent and got rid of some synonyms or mismatched names, like
BuildDefinition
being namedPipeline
.Test plan
Once this PR is merged and package published, I will run the
automation - build-failure-notification-subscriptions
pipeline from a branch that uses the new package and report how it went here. I do not expect any issues as the PR is composed only of automated refactoring and logged messages updates.If there are problems, I will re-run the pipeline from
main
to restore the notification setup.Update 1/26/2023: here is the build doing the test.
The pipeline run looks good, no issues.
Context
This PR originated by salvaging refactored code from this PR:
.yml
file synthetic sibling CODEOWNERS owners, instead of the owners of the.yml
file itself. #5194And significantly expanding upon it.
In general, I have bunch of related work upcoming pertaining to the logic modified in this PR, hence I am working on improving the code. Related issues:
notification-configuration
#5089