Azure / Azure/azure-sdk-tools

"automation - build-failure-notification-subscriptions" pipeline fails on unsupported team name

Open
#4,925 3 comments 0 reactions 1 assignee Claimed by @konrad-jamrozik View on GitHub
Central-EngSys
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

## The problem

The [internal / automation - build-failure-notification-subscriptions (Microsoft-internal)](https://dev.azure.com/azure-sdk/internal/_build?definitionId=679&_a=summary) pipeline [is failing on the `Run Team/Notification Creator` step with the following error](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2042219&view=logs&j=1f7b91b6-9a2a-5c83-7d3e-ca0fa5848c83&t=cdd04468-e304-5da0-e0b2-ea410a114c81&l=7961y):

```
info: Azure.Sdk.Tools.NotificationConfiguration.Services.AzureDevOpsService[0]
=> Evaluate Pipeline: Name = (2022-12-08 02:55:47) java - jdbc - tests, Path = \java, Id =
UpdateTeamForProjectAsync TeamName = (2022-12-08 02:55:47) java - jdbc - tests ProjectId =
Unhandled exception: Microsoft.TeamFoundation.Core.WebApi.InvalidTeamNameException: TF400472: The following team name is not valid: (2022-12-08 02:55:47) java - jdbc - tests. Verify that the name does not exceed the maximum character limit, only contains valid characters, and is not a reserved name. The following characters are not valid: @ ~ ; ' + = , < > | / \ ? : & $ * " # [ ]
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken)
at Azure.Sdk.Tools.NotificationConfiguration.Services.AzureDevOpsService.UpdateTeamForProjectAsync(String projectId, WebApiTeam team) in /mnt/vss/_work/1/s/tools/identity-resolution/Services/AzureDevOpsService.cs:line 183
at Azure.Sdk.Tools.NotificationConfiguration.NotificationConfigurator.EnsureTeamExists(BuildDefinition pipeline, TeamPurpose purpose, IEnumerable`1 teams, GitHubToAADConverter gitHubToAADConverter, Boolean persistChanges) in /mnt/vss/_work/1/s/tools/notification-configuration/notification-creator/NotificationConfigurator.cs:line 177
at Azure.Sdk.Tools.NotificationConfiguration.NotificationConfigurator.ConfigureNotifications(String projectName, String projectPath, GitHubToAADConverter gitHubToAADConverter, Boolean persistChanges, PipelineSelectionStrategy strategy) in /mnt/vss/_work/1/s/tools/notification-configuration/notification-creator/NotificationConfigurator.cs:line 55
at Azure.Sdk.Tools.NotificationConfiguration.Program.Main(String organization, String project, String pathPrefix, String tokenVariableName, String aadAppIdVar, String aadAppSecretVar, String aadTenantVar, PipelineSelectionStrategy selectionStrategy, Boolean dryRun) in /mnt/vss/_work/1/s/tools/notification-configuration/notification-creator/Program.cs:line 63
at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(Object value, InvocationContext context)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<b__0>d.MoveNext()
```

## Proposed fixes

To address the issue, all of the following should be done:

- Fix the logic in `NotificationConfigurator` to properly sanitize pipeline names when converting them to team names;
- Even with escaping implemented, get rid or rename the offending pipelines: [
(2022-12-08 02:55:47) java - jdbc - tests](https://dev.azure.com/azure-sdk/internal/_build?definitionId=5647) and [(2022-12-08 02:55:49) java - jdbc - tests-weekly](https://dev.azure.com/azure-sdk/internal/_build?definitionId=5648). Note that these pipelines are sourced from `tests.yml`, which is no longer available, as it was recently moved, [as seen in this PR](https://github.com/Azure/azure-sdk-for-java/commit/dc6b7d5805fabfa9bb50092be215b9eb60ff2aaa#diff-d6b1ffe0177f3e45a9e8be3c4fb7ff71149bb61121ce7798e647e128b5a3a5f0).

Note: pipelines end up being created with a timestamp in the name if one uses "clone pipeline" feature, which might be a likely culprit here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.