-
Notifications
You must be signed in to change notification settings - Fork 227
Add automation to report on non-released SDKs #13333
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d2cfc09
Add automation to report on non-released SDKs
smw-ms 9136a2a
Respond to copilot comments
smw-ms 39956f7
Merge branch 'main' of https://github.com/smw-ms/azure-sdk-tools into…
smw-ms 94730e8
Move to release plan tool
smw-ms c6d5ee5
fix release plan tests
smw-ms 6d09241
Resolve conflicts
smw-ms 42f3ca1
Update Changelog
smw-ms 3d45eea
Update Email Template
smw-ms 4b8c814
Resolve conflicts
smw-ms 39fddfc
Remove trailing whitespace
smw-ms 5d9145a
Fix merge conflicts
smw-ms cecc4e6
Merge branch 'main' of https://github.com/smw-ms/azure-sdk-tools into…
smw-ms 37fc869
Use ReleasePlanWorkItem instead of ReleasePlanDetails
smw-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| trigger: none | ||
| pr: none | ||
|
|
||
| variables: | ||
| - template: /eng/pipelines/templates/variables/image.yml | ||
|
|
||
| pool: | ||
| name: $(LINUXPOOL) | ||
| demands: ImageOverride -equals $(LINUXVMIMAGE) | ||
|
|
||
| jobs: | ||
| - job: ReportUnreleasedSdks | ||
| steps: | ||
| - checkout: self | ||
|
|
||
| - task: PowerShell@2 | ||
| displayName: 'Install Azure SDK MCP' | ||
smw-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| inputs: | ||
| targetType: 'inline' | ||
| script: './eng/common/mcp/azure-sdk-mcp.ps1 -InstallDirectory $(System.DefaultWorkingDirectory)' | ||
| pwsh: true | ||
| workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
|
|
||
| - task: AzureCLI@2 | ||
| displayName: Email product owners about overdue SDK release plans | ||
| inputs: | ||
| azureSubscription: opensource-api-connection | ||
| scriptType: pscore | ||
| scriptLocation: inlineScript | ||
| inlineScript: | | ||
| & "$(System.DefaultWorkingDirectory)/azsdk" release-plan list-overdue --notify-owners true --emailer-uri "$(AzureSDKEmailerSasURL)" | ||
smw-ms marked this conversation as resolved.
Show resolved
Hide resolved
smw-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using Moq; | ||
| using Moq.Protected; | ||
| using Azure.Sdk.Tools.Cli.Helpers; | ||
| using Azure.Sdk.Tools.Cli.Services; | ||
| using Azure.Sdk.Tools.Cli.Tests.Mocks.Services; | ||
|
|
@@ -21,6 +22,7 @@ internal class ReleasePlanToolTests | |
| private IEnvironmentHelper environmentHelper; | ||
| private ReleasePlanTool releasePlanTool; | ||
| private IInputSanitizer inputSanitizer; | ||
| private HttpClient httpClient; | ||
|
|
||
| [SetUp] | ||
| public void Setup() | ||
|
|
@@ -30,6 +32,7 @@ public void Setup() | |
| devOpsService = new MockDevOpsService(); | ||
| gitHubService = new MockGitHubService(); | ||
| inputSanitizer = new InputSanitizer(); | ||
| httpClient = new Mock<HttpClient>().Object; | ||
smw-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| var userHelperMock = new Mock<IUserHelper>(); | ||
| userHelperMock.Setup(x => x.GetUserEmail()).ReturnsAsync("[email protected]"); | ||
|
|
@@ -57,7 +60,8 @@ public void Setup() | |
| userHelper, | ||
| gitHubService, | ||
| environmentHelper, | ||
| inputSanitizer); | ||
| inputSanitizer, | ||
| httpClient); | ||
| } | ||
|
|
||
| [Test] | ||
|
|
@@ -150,7 +154,8 @@ public async Task Test_Create_releasePlan_with_AZSDKTOOLS_AGENT_TESTING_true_cre | |
| userHelper, | ||
| gitHubService, | ||
| environmentHelperMock.Object, | ||
| inputSanitizer); | ||
| inputSanitizer, | ||
| httpClient); | ||
|
|
||
| var testCodeFilePath = "TypeSpecTestData/specification/testcontoso/Contoso.Management"; | ||
|
|
||
|
|
@@ -191,7 +196,8 @@ public async Task Test_Create_releasePlan_with_AZSDKTOOLS_AGENT_TESTING_false_re | |
| userHelper, | ||
| gitHubService, | ||
| environmentHelperMock.Object, | ||
| inputSanitizer); | ||
| inputSanitizer, | ||
| httpClient); | ||
|
|
||
| var testCodeFilePath = "TypeSpecTestData/specification/testcontoso/Contoso.Management"; | ||
|
|
||
|
|
@@ -419,5 +425,200 @@ public async Task Test_update_spec_pull_request_with_non_specs_repo() | |
| Assert.That(response.ResponseError, Does.Contain("Invalid spec pull request URL")); | ||
| Assert.That(response.ResponseError, Does.Contain("azure-rest-api-specs")); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task Test_list_overdue_release_plans_notify_without_emailer_uri() | ||
| { | ||
| var response = await releasePlanTool.ListOverdueReleasePlans(notifyOwners: true, emailerUri: ""); | ||
| Assert.IsNotNull(response); | ||
| Assert.IsNotNull(response.ResponseError); | ||
| Assert.That(response.ResponseError, Does.Contain("Emailer URI is required")); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task Test_notification_includes_correct_missing_sdks() | ||
| { | ||
| var mockDevOps = new Mock<IDevOpsService>(); | ||
| var plan = new ReleasePlanWorkItem | ||
| { | ||
| WorkItemId = 200, | ||
| Owner = "Test Owner", | ||
| ReleasePlanSubmittedByEmail = "[email protected]", | ||
| IsManagementPlane = true, | ||
| IsDataPlane = false, | ||
| SDKReleaseMonth = "January 2026", | ||
| ReleasePlanLink = "https://example.com/releaseplan/200", | ||
| SDKInfo = | ||
| [ | ||
| new SDKInfo { Language = "Java", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" }, | ||
| new SDKInfo { Language = "Python", ReleaseStatus = "Released", ReleaseExclusionStatus = "Not applicable" }, | ||
| new SDKInfo { Language = ".NET", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" } | ||
| ] | ||
| }; | ||
| mockDevOps.Setup(x => x.ListOverdueReleasePlansAsync()).ReturnsAsync([plan]); | ||
|
|
||
| var mockHttpMessageHandler = new Mock<HttpMessageHandler>(); | ||
| var capturedBody = ""; | ||
| mockHttpMessageHandler.Protected() | ||
| .Setup<Task<HttpResponseMessage>>( | ||
| "SendAsync", | ||
| ItExpr.IsAny<HttpRequestMessage>(), | ||
| ItExpr.IsAny<CancellationToken>()) | ||
| .ReturnsAsync((HttpRequestMessage request, CancellationToken token) => | ||
| { | ||
| var content = request.Content?.ReadAsStringAsync().Result ?? ""; | ||
| var payload = JsonSerializer.Deserialize<JsonElement>(content); | ||
| capturedBody = payload.GetProperty("Body").GetString() ?? ""; | ||
| return new HttpResponseMessage(System.Net.HttpStatusCode.OK); | ||
| }); | ||
|
|
||
| var testHttpClient = new HttpClient(mockHttpMessageHandler.Object); | ||
| var tool = new ReleasePlanTool(mockDevOps.Object, gitHelper, typeSpecHelper, logger, userHelper, gitHubService, environmentHelper, inputSanitizer, testHttpClient); | ||
|
|
||
| await tool.ListOverdueReleasePlans(notifyOwners: true, emailerUri: "https://test.com/email"); | ||
|
|
||
| Assert.That(capturedBody, Does.Contain("Java")); | ||
| Assert.That(capturedBody, Does.Contain(".NET")); | ||
| Assert.That(capturedBody, Does.Not.Contain("Python")); // Released, should not be in missing list | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task Test_notification_excludes_approved_and_requested_languages() | ||
| { | ||
| var mockDevOps = new Mock<IDevOpsService>(); | ||
| var plan = new ReleasePlanWorkItem | ||
| { | ||
| WorkItemId = 201, | ||
| Owner = "Test Owner", | ||
| ReleasePlanSubmittedByEmail = "[email protected]", | ||
| IsManagementPlane = true, | ||
| IsDataPlane = false, | ||
| SDKReleaseMonth = "January 2026", | ||
| ReleasePlanLink = "https://example.com/releaseplan/201", | ||
| SDKInfo = | ||
| [ | ||
| new SDKInfo { Language = "Java", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" }, | ||
| new SDKInfo { Language = "Python", ReleaseStatus = "", ReleaseExclusionStatus = "Approved" }, | ||
| new SDKInfo { Language = ".NET", ReleaseStatus = "", ReleaseExclusionStatus = "Requested" } | ||
| ] | ||
| }; | ||
| mockDevOps.Setup(x => x.ListOverdueReleasePlansAsync()).ReturnsAsync([plan]); | ||
|
|
||
| var mockHttpMessageHandler = new Mock<HttpMessageHandler>(); | ||
| var capturedBody = ""; | ||
| mockHttpMessageHandler.Protected() | ||
| .Setup<Task<HttpResponseMessage>>( | ||
| "SendAsync", | ||
| ItExpr.IsAny<HttpRequestMessage>(), | ||
| ItExpr.IsAny<CancellationToken>()) | ||
| .ReturnsAsync((HttpRequestMessage request, CancellationToken token) => | ||
| { | ||
| var content = request.Content?.ReadAsStringAsync().Result ?? ""; | ||
| var payload = JsonSerializer.Deserialize<JsonElement>(content); | ||
| capturedBody = payload.GetProperty("Body").GetString() ?? ""; | ||
| return new HttpResponseMessage(System.Net.HttpStatusCode.OK); | ||
| }); | ||
|
|
||
| var testHttpClient = new HttpClient(mockHttpMessageHandler.Object); | ||
| var tool = new ReleasePlanTool(mockDevOps.Object, gitHelper, typeSpecHelper, logger, userHelper, gitHubService, environmentHelper, inputSanitizer, testHttpClient); | ||
|
|
||
| await tool.ListOverdueReleasePlans(notifyOwners: true, emailerUri: "https://test.com/email"); | ||
|
|
||
| Assert.That(capturedBody, Does.Contain("Java")); | ||
| Assert.That(capturedBody, Does.Not.Contain("Python")); // Approved exclusion | ||
| Assert.That(capturedBody, Does.Not.Contain(".NET")); // Requested exclusion | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task Test_notification_excludes_go_for_dataplane() | ||
| { | ||
| var mockDevOps = new Mock<IDevOpsService>(); | ||
| var plan = new ReleasePlanWorkItem | ||
| { | ||
| WorkItemId = 202, | ||
| Owner = "Test Owner", | ||
| ReleasePlanSubmittedByEmail = "[email protected]", | ||
| IsDataPlane = true, | ||
| IsManagementPlane = false, | ||
| SDKReleaseMonth = "January 2026", | ||
| ReleasePlanLink = "https://example.com/releaseplan/202", | ||
| SDKInfo = | ||
| [ | ||
| new SDKInfo { Language = "Java", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" }, | ||
| new SDKInfo { Language = "Go", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" } | ||
| ] | ||
| }; | ||
| mockDevOps.Setup(x => x.ListOverdueReleasePlansAsync()).ReturnsAsync([plan]); | ||
|
|
||
| var mockHttpMessageHandler = new Mock<HttpMessageHandler>(); | ||
| var capturedBody = ""; | ||
| mockHttpMessageHandler.Protected() | ||
| .Setup<Task<HttpResponseMessage>>( | ||
| "SendAsync", | ||
| ItExpr.IsAny<HttpRequestMessage>(), | ||
| ItExpr.IsAny<CancellationToken>()) | ||
| .ReturnsAsync((HttpRequestMessage request, CancellationToken token) => | ||
| { | ||
| var content = request.Content?.ReadAsStringAsync().Result ?? ""; | ||
| var payload = JsonSerializer.Deserialize<JsonElement>(content); | ||
| capturedBody = payload.GetProperty("Body").GetString() ?? ""; | ||
| return new HttpResponseMessage(System.Net.HttpStatusCode.OK); | ||
| }); | ||
|
|
||
| var testHttpClient = new HttpClient(mockHttpMessageHandler.Object); | ||
| var tool = new ReleasePlanTool(mockDevOps.Object, gitHelper, typeSpecHelper, logger, userHelper, gitHubService, environmentHelper, inputSanitizer, testHttpClient); | ||
|
|
||
| await tool.ListOverdueReleasePlans(notifyOwners: true, emailerUri: "https://test.com/email"); | ||
|
|
||
| Assert.That(capturedBody, Does.Contain("Java")); | ||
| Assert.That(capturedBody, Does.Not.Contain("Go")); // Filtered for Data Plane | ||
| Assert.That(capturedBody, Does.Contain("Data Plane")); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task Test_notification_includes_go_for_management_plane() | ||
| { | ||
| var mockDevOps = new Mock<IDevOpsService>(); | ||
| var plan = new ReleasePlanWorkItem | ||
| { | ||
| WorkItemId = 203, | ||
| Owner = "Test Owner", | ||
| ReleasePlanSubmittedByEmail = "[email protected]", | ||
| IsManagementPlane = true, | ||
| IsDataPlane = false, | ||
| SDKReleaseMonth = "January 2026", | ||
| ReleasePlanLink = "https://example.com/releaseplan/203", | ||
| SDKInfo = | ||
| [ | ||
| new SDKInfo { Language = "Java", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" }, | ||
| new SDKInfo { Language = "Go", ReleaseStatus = "", ReleaseExclusionStatus = "Not applicable" } | ||
| ] | ||
| }; | ||
| mockDevOps.Setup(x => x.ListOverdueReleasePlansAsync()).ReturnsAsync([plan]); | ||
|
|
||
| var mockHttpMessageHandler = new Mock<HttpMessageHandler>(); | ||
| var capturedBody = ""; | ||
| mockHttpMessageHandler.Protected() | ||
| .Setup<Task<HttpResponseMessage>>( | ||
| "SendAsync", | ||
| ItExpr.IsAny<HttpRequestMessage>(), | ||
| ItExpr.IsAny<CancellationToken>()) | ||
| .ReturnsAsync((HttpRequestMessage request, CancellationToken token) => | ||
| { | ||
| var content = request.Content?.ReadAsStringAsync().Result ?? ""; | ||
| var payload = JsonSerializer.Deserialize<JsonElement>(content); | ||
| capturedBody = payload.GetProperty("Body").GetString() ?? ""; | ||
| return new HttpResponseMessage(System.Net.HttpStatusCode.OK); | ||
| }); | ||
|
|
||
| var testHttpClient = new HttpClient(mockHttpMessageHandler.Object); | ||
| var tool = new ReleasePlanTool(mockDevOps.Object, gitHelper, typeSpecHelper, logger, userHelper, gitHubService, environmentHelper, inputSanitizer, testHttpClient); | ||
|
|
||
| await tool.ListOverdueReleasePlans(notifyOwners: true, emailerUri: "https://test.com/email"); | ||
|
|
||
| Assert.That(capturedBody, Does.Contain("Java")); | ||
| Assert.That(capturedBody, Does.Contain("Go")); // Included for Management Plane | ||
| Assert.That(capturedBody, Does.Contain("Management Plane")); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.