Skip to content

Commit 498b2af

Browse files
authored
Merge branch 'main' into dev/Aman-Jain-14/StorageCache_AutoImport_2025-05-01_API_spec
2 parents 6fdff4d + 9191854 commit 498b2af

File tree

944 files changed

+98290
-3886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

944 files changed

+98290
-3886
lines changed

.github/package-lock.json

+14-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/post-apiview.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
if: |
1616
github.event.check_run.check_suite.app.name == 'Azure Pipelines' && (
1717
contains(github.event.check_run.name, 'APIView') ||
18-
contains(github.event.check_run.name, 'SDK Generation') )
18+
contains(github.event.check_run.name, 'SDK Generation') ||
19+
contains(github.event.check_run.name, 'SDK azure-sdk-for-') )
1920
steps:
2021
- name: Checkout
2122
uses: actions/checkout@v4

.github/workflows/src/context.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,22 @@ export async function extractInputs(github, context, core) {
130130
core.info(
131131
`listPullRequestsAssociatedWithCommit(${head_owner}, ${head_repo}, ${head_sha})`,
132132
);
133-
const pullRequests = await github.paginate(
134-
github.rest.repos.listPullRequestsAssociatedWithCommit,
135-
{
136-
owner: head_owner,
137-
repo: head_repo,
138-
commit_sha: head_sha,
139-
per_page: PER_PAGE_MAX,
140-
},
133+
const pullRequests = (
134+
await github.paginate(
135+
github.rest.repos.listPullRequestsAssociatedWithCommit,
136+
{
137+
owner: head_owner,
138+
repo: head_repo,
139+
commit_sha: head_sha,
140+
per_page: PER_PAGE_MAX,
141+
},
142+
)
143+
).filter(
144+
// Only include PRs to the same repo as the triggering workflow.
145+
//
146+
// Other unique keys like "full_name" should also work, but "id" is the safest since it's
147+
// supposed to be guaranteed unique and never change (repos can be renamed or change owners).
148+
(pr) => pr.base.repo.id === payload.workflow_run.repository.id,
141149
);
142150

143151
if (pullRequests.length === 0) {

.github/workflows/test/context.test.js

+27-3
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ describe("extractInputs", () => {
198198
});
199199
});
200200

201-
it.each([0, 1, 2])(
201+
it.each([0, 1, 2, 3])(
202202
"workflow_run:completed:pull_request (fork repo, %s PRs)",
203203
async (numPullRequests) => {
204204
const context = {
@@ -216,6 +216,7 @@ describe("extractInputs", () => {
216216
head_sha: "abc123",
217217
id: 456,
218218
repository: {
219+
id: 1234,
219220
name: "TestRepoName",
220221
owner: {
221222
login: "TestRepoOwnerLogin",
@@ -231,7 +232,28 @@ describe("extractInputs", () => {
231232
async (args) => {
232233
console.log(JSON.stringify(args));
233234
return {
234-
data: [{ number: 123 }, { number: 124 }].slice(0, numPullRequests),
235+
data: [
236+
{
237+
base: {
238+
repo: { id: 1234 },
239+
},
240+
number: 123,
241+
},
242+
// Ensure PRs to other repos are excluded
243+
{
244+
base: {
245+
repo: { id: 4567 },
246+
},
247+
number: 1,
248+
},
249+
// Multiple PRs to triggering repo still causes an error (TODO: #33418)
250+
{
251+
base: {
252+
repo: { id: 1234 },
253+
},
254+
number: 124,
255+
},
256+
].slice(0, numPullRequests),
235257
};
236258
},
237259
);
@@ -266,7 +288,8 @@ describe("extractInputs", () => {
266288
});
267289

268290
expect(github.rest.search.issuesAndPullRequests).toHaveBeenCalled();
269-
} else if (numPullRequests === 1) {
291+
} else if (numPullRequests === 1 || numPullRequests === 2) {
292+
// Second PR is to a different repo, so expect same behavior with or without it
270293
await expect(
271294
extractInputs(github, context, createMockCore()),
272295
).resolves.toEqual({
@@ -277,6 +300,7 @@ describe("extractInputs", () => {
277300
run_id: 456,
278301
});
279302
} else {
303+
// Multiple PRs to triggering repo still causes an error (TODO: #33418)
280304
await expect(
281305
extractInputs(github, context, createMockCore()),
282306
).rejects.toThrow("Unexpected number of pull requests");

eng/common/TestResources/New-TestResources.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ $serialized
657657
'`@ | ConvertFrom-Json -AsHashtable
658658
# Set global variables that aren't always passed as parameters
659659
`$ResourceGroupName = `$parameters.ResourceGroupName
660+
`$AdditionalParameters = `$parameters.AdditionalParameters
660661
`$DeploymentOutputs = `$parameters.DeploymentOutputs
661662
$postDeploymentScript `@parameters
662663
"@

eng/common/scripts/Helpers/ApiView-Helpers.ps1

+3-2
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ function Set-ApiViewCommentForPR {
180180
$commentText += "APIView identified API level changes in this PR and created the following API reviews"
181181
$commentText += ""
182182

183+
$responseContent = $response.Content | ConvertFrom-Json
183184
if ($RepoName.StartsWith(("azure-sdk-for-"))) {
184-
$response | ForEach-Object {
185+
$responseContent | ForEach-Object {
185186
$commentText += "[$($_.packageName)]($($_.url))"
186187
}
187188
} else {
188189
$commentText += "| Language | API Review for Package |"
189190
$commentText += "|----------|---------|"
190-
$response | ForEach-Object {
191+
$responseContent | ForEach-Object {
191192
$commentText += "| $($_.language) | [$($_.packageName)]($($_.url)) |"
192193
}
193194
}

eng/common/scripts/job-matrix/Create-JobMatrix.ps1

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ param (
1515
[Parameter(Mandatory=$False)][array] $Filters,
1616
[Parameter(Mandatory=$False)][array] $Replace,
1717
[Parameter(Mandatory=$False)][array] $NonSparseParameters,
18+
# Use for local generation/debugging when env: values are set in a matrix
19+
[Parameter(Mandatory=$False)][switch] $SkipEnvironmentVariables,
1820
[Parameter()][switch] $CI = ($null -ne $env:SYSTEM_TEAMPROJECTID)
1921
)
2022

@@ -34,7 +36,8 @@ $Filters = $Filters | Where-Object { $_ }
3436
-displayNameFilter $DisplayNameFilter `
3537
-filters $Filters `
3638
-replace $Replace `
37-
-nonSparseParameters $NonSparseParameters
39+
-nonSparseParameters $NonSparseParameters `
40+
-skipEnvironmentVariables:$SkipEnvironmentVariables
3841

3942
$serialized = SerializePipelineMatrix $matrix
4043

eng/common/scripts/job-matrix/job-matrix-functions.ps1

+22-22
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ function GenerateMatrix(
101101
) {
102102
$result = ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
103103

104-
$matrixParameters = $result.Matrix
105-
$importedMatrix = $result.ImportedMatrix
104+
$matrixParameters = $result.Matrix
105+
$importedMatrix = $result.ImportedMatrix
106106
$combinedDisplayNameLookup = $result.DisplayNamesLookup
107107

108108
if ($selectFromMatrixType -eq "sparse") {
@@ -148,7 +148,7 @@ function ProcessNonSparseParameters(
148148
$nonSparse = [MatrixParameter[]]@()
149149

150150
foreach ($param in $parameters) {
151-
if ($null -eq $param){
151+
if ($null -eq $param) {
152152
continue
153153
}
154154
if ($param.Name -in $nonSparseParameters) {
@@ -430,9 +430,9 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
430430
}
431431
if ((!$matrix -and !$importPath) -or !$importPath) {
432432
return [PSCustomObject]@{
433-
Matrix = $matrix
434-
ImportedMatrix = @()
435-
DisplayNamesLookup = $displayNamesLookup
433+
Matrix = $matrix
434+
ImportedMatrix = @()
435+
DisplayNamesLookup = $displayNamesLookup
436436
}
437437
}
438438

@@ -456,9 +456,9 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
456456
}
457457

458458
return [PSCustomObject]@{
459-
Matrix = $matrix ?? @()
460-
ImportedMatrix = $importedMatrix
461-
DisplayNamesLookup = $combinedDisplayNameLookup
459+
Matrix = $matrix ?? @()
460+
ImportedMatrix = $importedMatrix
461+
DisplayNamesLookup = $combinedDisplayNameLookup
462462
}
463463
}
464464

@@ -643,7 +643,7 @@ function InitializeMatrix {
643643
function GetMatrixDimensions([MatrixParameter[]]$parameters) {
644644
$dimensions = @()
645645
foreach ($param in $parameters) {
646-
if ($null -eq $param){
646+
if ($null -eq $param) {
647647
continue
648648
}
649649
$dimensions += $param.Length()
@@ -760,12 +760,12 @@ function Get4dMatrixIndex([int]$index, [Array]$dimensions) {
760760

761761
function GenerateMatrixForConfig {
762762
param (
763-
[Parameter(Mandatory = $true)][string] $ConfigPath,
764-
[Parameter(Mandatory = $true)][string] $Selection,
765-
[Parameter(Mandatory = $false)][string] $DisplayNameFilter,
766-
[Parameter(Mandatory = $false)][array] $Filters,
767-
[Parameter(Mandatory = $false)][array] $Replace,
768-
[Parameter(Mandatory = $false)][Array] $NonSparseParameters = @()
763+
[Parameter(Mandatory = $true)][string] $ConfigPath,
764+
[Parameter(Mandatory = $true)][string] $Selection,
765+
[Parameter(Mandatory = $false)][string] $DisplayNameFilter,
766+
[Parameter(Mandatory = $false)][array] $Filters,
767+
[Parameter(Mandatory = $false)][array] $Replace,
768+
[Parameter(Mandatory = $false)][Array] $NonSparseParameters = @()
769769
)
770770
$matrixFile = Join-Path $PSScriptRoot ".." ".." ".." ".." $ConfigPath
771771

@@ -776,12 +776,12 @@ function GenerateMatrixForConfig {
776776
$Filters = $Filters | Where-Object { $_ }
777777

778778
[array]$matrix = GenerateMatrix `
779-
-config $config `
780-
-selectFromMatrixType $Selection `
781-
-displayNameFilter $DisplayNameFilter `
782-
-filters $Filters `
783-
-replace $Replace `
784-
-nonSparseParameters $NonSparseParameters
779+
-config $config `
780+
-selectFromMatrixType $Selection `
781+
-displayNameFilter $DisplayNameFilter `
782+
-filters $Filters `
783+
-replace $Replace `
784+
-nonSparseParameters $NonSparseParameters
785785

786786
return , $matrix
787787
}

eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1

+9-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ function Login([string]$subscription, [string]$tenant, [string]$clusterGroup, [s
4848
Write-Host "Logging in to subscription, cluster and container registry"
4949
az account show -s "$subscription" *> $null
5050
if ($LASTEXITCODE) {
51-
RunOrExitOnFailure az login --allow-no-subscriptions --tenant $tenant
51+
Run az login --allow-no-subscriptions --tenant $tenant
52+
if ($LASTEXITCODE) {
53+
throw "You do not have access to the TME subscription. Follow these steps to join the group: https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/206/Subscription-and-Tenant-Usage?anchor=azure-sdk-test-resources-tme"
54+
}
55+
}
56+
57+
$subscriptions = (Run az account list -o json) | ConvertFrom-Json
58+
if ($subscriptions.Length -eq 0) {
59+
throw "You do not have access to the TME subscription. Follow these steps to join the group: https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/206/Subscription-and-Tenant-Usage?anchor=azure-sdk-test-resources-tme"
5260
}
5361

5462
# Discover cluster name, only one cluster per group is expected

eng/common/testproxy/test-proxy-standalone-tool.yml

+19
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,54 @@ steps:
3232
}
3333
3434
Write-Host "Installing test-proxy version $version"
35+
Write-Host "${{ parameters.templateRoot }}/eng/common/testproxy/install-test-proxy.ps1 -Version $version -InstallDirectory $(Build.BinariesDirectory)/test-proxy"
3536
${{ parameters.templateRoot }}/eng/common/testproxy/install-test-proxy.ps1 -Version $version -InstallDirectory $(Build.BinariesDirectory)/test-proxy
3637
displayName: "Install test-proxy"
3738
condition: and(succeeded(), ${{ parameters.condition }})
3839
3940
- pwsh: |
41+
Write-Host "Prepending path with the test proxy tool install location: '$(Build.BinariesDirectory)/test-proxy'"
4042
Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)/test-proxy"
4143
displayName: "Prepend path with test-proxy tool install location"
4244
4345
- ${{ if eq(parameters.runProxy, 'true') }}:
4446
- pwsh: |
47+
Write-Host "Setting ASPNETCORE_Kestrel__Certificates__Default__Path to '${{ parameters.templateRoot }}/eng/common/testproxy/dotnet-devcert.pfx'"
4548
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]${{ parameters.templateRoot }}/eng/common/testproxy/dotnet-devcert.pfx"
49+
Write-Host "Setting ASPNETCORE_Kestrel__Certificates__Default__Password to 'password'"
4650
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password"
51+
Write-Host "Setting PROXY_MANUAL_START to 'true'"
4752
Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true"
4853
displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables'
4954
condition: and(succeeded(), ${{ parameters.condition }})
5055
5156
- pwsh: |
57+
$invocation = @"
58+
Start-Process $(PROXY_EXE)
59+
-ArgumentList `"start -u --storage-location ${{ parameters.rootFolder }}`"
60+
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log
61+
-RedirectStandardError ${{ parameters.rootFolder }}/test-proxy-error.log
62+
"@
63+
Write-Host $invocation
64+
5265
$Process = Start-Process $(PROXY_EXE) `
5366
-ArgumentList "start -u --storage-location ${{ parameters.rootFolder }}" `
5467
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log `
5568
-RedirectStandardError ${{ parameters.rootFolder }}/test-proxy-error.log
5669
70+
Write-Host "Setting PROXY_PID to $($Process.Id)"
5771
Write-Host "##vso[task.setvariable variable=PROXY_PID]$($Process.Id)"
5872
displayName: 'Run the testproxy - windows'
5973
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
6074
6175
# nohup does NOT continue beyond the current session if you use it within powershell
6276
- bash: |
77+
echo "nohup $(PROXY_EXE) 1>${{ parameters.rootFolder }}/test-proxy.log 2>${{ parameters.rootFolder }}/test-proxy-error.log &"
6378
nohup $(PROXY_EXE) 1>${{ parameters.rootFolder }}/test-proxy.log 2>${{ parameters.rootFolder }}/test-proxy-error.log &
6479
6580
echo $! > $(Build.SourcesDirectory)/test-proxy.pid
81+
82+
echo "Setting PROXY_PID to $(cat $(Build.SourcesDirectory)/test-proxy.pid)"
6683
echo "##vso[task.setvariable variable=PROXY_PID]$(cat $(Build.SourcesDirectory)/test-proxy.pid)"
6784
displayName: "Run the testproxy - linux/mac"
6885
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
@@ -71,7 +88,9 @@ steps:
7188
- pwsh: |
7289
for ($i = 0; $i -lt 10; $i++) {
7390
try {
91+
Write-Host "Invoke-WebRequest -Uri `"http://localhost:5000/Admin/IsAlive`" | Out-Null"
7492
Invoke-WebRequest -Uri "http://localhost:5000/Admin/IsAlive" | Out-Null
93+
Write-Host "Successfully connected to the test proxy on port 5000."
7594
exit 0
7695
} catch {
7796
Write-Warning "Failed to successfully connect to test proxy. Retrying..."

0 commit comments

Comments
 (0)