Skip to content

Commit 1d73574

Browse files
committed
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python into drop-python-3.8
2 parents a5a58dd + b305dc7 commit 1d73574

806 files changed

Lines changed: 16742 additions & 179609 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299

300300
# ServiceLabel: %Maps
301301
# PRLabel: %Maps
302-
/sdk/maps/ @dubiety
302+
/sdk/maps/ @dubiety @andykao1213
303303

304304
# ServiceLabel: %Mixed Reality
305305
# PRLabel: %Mixed Reality

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ parameters:
6767
type: object
6868
default: []
6969

70+
# The path to the emitter package json file.
71+
- name: EmitterPackageJsonOutputPath
72+
type: string
73+
default: "eng/emitter-package.json"
74+
75+
# The relative path to the emitter package.
76+
- name: EmitterPackagePath
77+
type: string
78+
7079
extends:
7180
template: /eng/pipelines/templates/stages/1es-redirect.yml
7281
parameters:
@@ -94,7 +103,17 @@ extends:
94103
inputs:
95104
pwsh: true
96105
filePath: $(Build.SourcesDirectory)/eng/scripts/typespec/Initialize-WorkingDirectory.ps1
97-
arguments: -UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
106+
${{ if parameters.BuildPrereleaseVersion }}:
107+
arguments: >
108+
-PrereleaseSuffix "-alpha.$(Build.BuildNumber)"
109+
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
110+
-UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
111+
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
112+
${{ else }}:
113+
arguments: >
114+
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
115+
-UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
116+
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
98117
99118
- task: PowerShell@2
100119
displayName: 'Run build script'
@@ -103,10 +122,9 @@ extends:
103122
pwsh: true
104123
filePath: $(Build.SourcesDirectory)/eng/scripts/typespec/Build-Emitter.ps1
105124
arguments: >
106-
-BuildNumber "$(Build.BuildNumber)"
107-
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
125+
-OutputDirectory "$(Build.ArtifactStagingDirectory)/packages"
108126
-TargetNpmJsFeed:$${{ parameters.PublishPublic }}
109-
-Prerelease:$${{ parameters.BuildPrereleaseVersion }}
127+
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
110128
111129
- pwsh: |
112130
$sourceBranch = '$(Build.SourceBranch)'
@@ -134,7 +152,7 @@ extends:
134152
# Publish stage
135153
# Responsible for publishing the packages in `build_artifacts/packages` and producing `emitter-package-lock.json`
136154
# Produces the artifact `publish_artifacts` which contains the following:
137-
# emitter-package.json: Created using the package json from the build step.
155+
# emitter-package.json: Created using the package json from the build step.
138156
# emitter-package-lock.json: Created by calling `npm install` using `emitter-package.json`
139157
- ${{ if parameters.ShouldPublish }}:
140158
- stage: Publish
@@ -189,26 +207,30 @@ extends:
189207
ServiceEndpointUrl: https://api.esrp.microsoft.com
190208
MainPublisher: ESRPRELPACMANTEST
191209

192-
- task: PowerShell@2
193-
displayName: Create emitter-package.json
194-
inputs:
195-
pwsh: true
196-
filePath: ./eng/common/scripts/typespec/New-EmitterPackageJson.ps1
197-
arguments: >
198-
-PackageJsonPath '$(buildArtifactsPath)/lock-files/package.json'
199-
-OverridesPath '$(buildArtifactsPath)/overrides.json'
200-
-OutputDirectory '$(Build.ArtifactStagingDirectory)'
201-
workingDirectory: $(Build.SourcesDirectory)
210+
- pwsh: |
211+
npm install -g @azure-tools/typespec-client-generator-cli@latest
212+
displayName: Install tsp-client
202213
203-
- task: PowerShell@2
204-
displayName: Create emitter-package-lock.json
205-
inputs:
206-
pwsh: true
207-
filePath: ./eng/common/scripts/typespec/New-EmitterPackageLock.ps1
208-
arguments: >
209-
-EmitterPackageJsonPath '$(Build.ArtifactStagingDirectory)/emitter-package.json'
210-
-OutputDirectory '$(Build.ArtifactStagingDirectory)'
211-
workingDirectory: $(Build.SourcesDirectory)
214+
- pwsh: |
215+
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
216+
217+
if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
218+
Write-Host "Using overrides.json to generate emitter-package.json"
219+
tsp-client generate-config-files `
220+
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
221+
--output-dir '$(Build.SourcesDirectory)' `
222+
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}' `
223+
--overrides '$(buildArtifactsPath)/packages/overrides.json'
224+
} else {
225+
Write-Host "No overrides.json found. Running tsp-client without overrides."
226+
227+
tsp-client generate-config-files `
228+
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
229+
--output-dir '$(Build.SourcesDirectory)' `
230+
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}'
231+
}
232+
displayName: Generate emitter-package.json and emitter-package-lock files
233+
workingDirectory: $(Build.SourcesDirectory)
212234
213235
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
214236
parameters:
@@ -240,11 +262,8 @@ extends:
240262
displayName: Download pipeline artifacts
241263

242264
- pwsh: |
243-
Write-Host "Copying emitter-package.json to $(Build.SourcesDirectory)/eng"
244-
Copy-Item $(publishArtifactsPath)/emitter-package.json $(Build.SourcesDirectory)/eng/ -Force
245-
246-
Write-Host "Copying emitter-package-lock.json to $(Build.SourcesDirectory)/eng"
247-
Copy-Item $(publishArtifactsPath)/emitter-package-lock.json $(Build.SourcesDirectory)/eng/ -Force
265+
Write-Host "Copying *emitter-package*.json to $(Build.SourcesDirectory)/eng"
266+
Copy-Item $(publishArtifactsPath)/*emitter-package*.json $(Build.SourcesDirectory)/eng/ -Force
248267
displayName: Copy emitter-package json files
249268
250269
- ${{ parameters.InitializationSteps }}
@@ -291,7 +310,7 @@ extends:
291310
Paths:
292311
- "/*"
293312
- "!SessionRecords"
294-
313+
295314
- download: current
296315
displayName: Download pipeline artifacts
297316

@@ -432,7 +451,9 @@ extends:
432451
inputs:
433452
pwsh: true
434453
filePath: $(Build.SourcesDirectory)/eng/scripts/typespec/Initialize-WorkingDirectory.ps1
435-
arguments: -BuildArtifactsPath '$(buildArtifactsPath)'
454+
arguments: >
455+
-BuildArtifactsPath '$(buildArtifactsPath)/lock-files'
456+
-EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
436457
437458
- task: PowerShell@2
438459
displayName: 'Run test script'
@@ -442,6 +463,7 @@ extends:
442463
arguments: >
443464
$(TestArguments)
444465
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
466+
-EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
445467
446468
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
447469
parameters:

eng/common/scripts/Package-Properties.ps1

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,28 @@ class PackageProps {
115115
return $null
116116
}
117117

118-
[PSCustomObject]GetCIYmlForArtifact() {
118+
[System.IO.FileInfo[]]ResolveCIFolderPath() {
119119
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..")
120-
121120
$ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory)
122-
$ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File)
121+
$ciFiles = @()
122+
123+
# if this path exists, then we should look in it for the ci.yml files and return nothing if nothing is found
124+
if (Test-Path $ciFolderPath){
125+
$ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File)
126+
}
127+
# if not, we should at least try to resolve the eng/ folder to fall back and see if that's where the path exists
128+
else {
129+
$ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "eng" $this.ServiceDirectory)
130+
if (Test-Path $ciFolderPath) {
131+
$ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File)
132+
}
133+
}
134+
135+
return $ciFiles
136+
}
137+
138+
[PSCustomObject]GetCIYmlForArtifact() {
139+
$ciFiles = @($this.ResolveCIFolderPath())
123140
$ciArtifactResult = $null
124141
$soleCIYml = ($ciFiles.Count -eq 1)
125142

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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 22 additions & 22 deletions
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
}

scripts/auto_release/requirement.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ PyGithub==1.55
55
packaging==24.1
66
pytest==6.2.5
77
fastcore==1.3.25
8-
tox==4.15.0
8+
tox==4.15.0
9+
wheel==0.46.1
10+
setuptools==78.1.0

scripts/automation_generate.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/bin/bash
22

3-
VIRTUAL_ENV=$TMPDIR/venv-sdk
4-
export VIRTUAL_ENV
5-
PATH="$VIRTUAL_ENV/bin:$PATH"
6-
export PATH
7-
8-
TEMP_FILE="$TMPDIR/venv-sdk/auto_temp.json"
3+
TEMP_FILE="$TMPDIR/auto_temp.json"
94
# generate code
105
python -m packaging_tools.sdk_generator "$1" "$TEMP_FILE" --debug 2>&1
116
echo "[Generate] codegen done!!!"

scripts/automation_init.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
#!/bin/bash
22

3-
# install python3.10
4-
sudo add-apt-repository ppa:deadsnakes/ppa > /dev/null
5-
sudo apt-get install python3.10 > /dev/null
6-
sudo apt-get install python3.10-venv > /dev/null
7-
83
# init env
9-
rm -rf $TMPDIR/venv-sdk > /dev/null
10-
python3.10 -m venv $TMPDIR/venv-sdk > /dev/null
11-
VIRTUAL_ENV=$TMPDIR/venv-sdk
12-
export VIRTUAL_ENV
13-
PATH="$VIRTUAL_ENV/bin:$PATH"
14-
export PATH
154
python -m pip install -U pip > /dev/null
165
python scripts/dev_setup.py -p azure-core > /dev/null
176
pip install tox==4.15.0 > /dev/null
7+
pip install wheel==0.46.1 > /dev/null
8+
pip install setuptools==78.1.0 > /dev/null
189

1910
# install tsp-client globally (local install may interfere with tooling)
2011
echo Install tsp-client
21-
sudo npm install -g @azure-tools/typespec-client-generator-cli > /dev/null
12+
sudo npm install -g @azure-tools/typespec-client-generator-cli@0.20.0 > /dev/null
2213

2314
echo "{}" >> $2
2415
echo "[Generate] init success!!!"

sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,11 @@ def refresh(self, **kwargs) -> None: # pylint: disable=too-many-statements
366366
if self._feature_flag_refresh_enabled:
367367
need_ff_refresh, refresh_on_feature_flags, feature_flags, filters_used = (
368368
client.refresh_feature_flags(
369-
self._refresh_on_feature_flags, self._feature_flag_selectors, headers=headers, **kwargs
369+
self._refresh_on_feature_flags,
370+
self._feature_flag_selectors,
371+
headers,
372+
self._origin_endpoint,
373+
**kwargs,
370374
)
371375
)
372376
if refresh_on_feature_flags:
@@ -425,7 +429,11 @@ def _load_all(self, **kwargs):
425429
configuration_settings_processed = self._process_configurations(configuration_settings)
426430
if self._feature_flag_enabled:
427431
feature_flags, feature_flag_sentinel_keys, used_filters = client.load_feature_flags(
428-
self._feature_flag_selectors, self._feature_flag_refresh_enabled, headers=headers, **kwargs
432+
self._feature_flag_selectors,
433+
self._feature_flag_refresh_enabled,
434+
self._origin_endpoint,
435+
headers=headers,
436+
**kwargs,
429437
)
430438
self._feature_filter_usage = used_filters
431439
configuration_settings_processed[FEATURE_MANAGEMENT_KEY] = {}

0 commit comments

Comments
 (0)