Skip to content

Commit 2dfd440

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-python into correct_healthcare
* 'master' of https://github.com/Azure/azure-sdk-for-python: (30 commits) [EventGrid] Improve docs (Azure#16986) Fixed delete_blob method signature (Azure#16983) Fixed Content-MD5 serialization and typing (Azure#16987) [eventgrid] Black formatting and tests suite (Azure#16989) Appconfig perf test (Azure#16809) adds support for milliseconds on datetime objects (Azure#16847) [ServiceBus] Improve AMQP Error handling (Azure#16427) T2 resource 2021 02 26 (Azure#16961) T2 servicefabricmanagedclusters 2021 02 26 (Azure#16958) Update Prepare-Release script (Azure#16976) the previous filter was erroneously filtering out real files. (Azure#16978) Update azure-core minimum version (Azure#16968) update documention in depends section of eng_sys_checks.md (Azure#16967) version (Azure#16959) T2 web 2021 02 24 (Azure#16901) Change test pipeline to run in eastus2 (Azure#16950) Adding azure-devtools to mr-auth dev_requirements (Azure#16953) Add perf tests for eventgrid (Azure#16949) temp fix for canary tests (Azure#16945) Update get_package_properties to also return path to setup.py (Azure#16946) ...
2 parents 78371a2 + 36f2003 commit 2dfd440

File tree

946 files changed

+343026
-46737
lines changed

Some content is hidden

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

946 files changed

+343026
-46737
lines changed

ci_template.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ trigger:
55
branches:
66
include:
77
- master
8+
- main
89
- hotfix/*
910
- release/*
1011
- restapi*
@@ -16,6 +17,7 @@ pr:
1617
branches:
1718
include:
1819
- master
20+
- main
1921
- feature/*
2022
- hotfix/*
2123
- release/*

doc/eng_sys_checks.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Analyze job in both nightly CI and pull request validation pipeline runs a set o
4848
Change log verification is added to ensure package has valid change log for current version. Guidelines to properly maintain the change log is documented [here](https://github.com/Azure/azure-sdk-for-python/blob/master/doc/)
4949

5050
## PR Validation Checks
51-
Each pull request runs various tests using `pytest` in addition to all the tests mentioned above in analyze check. Pull request validation performs 3 different types of test: `whl, sdist and depends`. Following section explains the purpose of each of these tests and how to execute them locally. All pull requests are validated on multiple python versions across different platforms and below is the test matrix for pull request.
51+
Each pull request runs various tests using `pytest` in addition to all the tests mentioned above in analyze check. Pull request validation performs 3 different types of test: `whl, sdist and depends`. The following section explains the purpose of each of these tests and how to execute them locally. All pull requests are validated on multiple python versions across different platforms. Find the test matrix below.
5252

5353

5454
|`Python Version`|`Platform` |
@@ -73,8 +73,8 @@ This test installs sdist of the package being tested and runs all tests cases in
7373
2. Run following command
7474
``tox -e sdist -c ../../../eng/tox/tox.ini``
7575

76-
####depends
77-
This test is to ensure all modules in the package being tested can be successfully imported. This is to ensure all package requirement is properly set in setup.py as well as to ensure modules are imported using valid namespace. This test install the package and it's required packages and executes `from <package-root-namespace> import *`. For e.g. `from azure.core import *`.
76+
#### depends
77+
The `depends` check ensures all modules in a target package can be successfully imported. Actually installing and importing will verify that all package requirements are properly set in setup.py and that the `__all__` set for the package is properly defined. This test installs the package and its required packages, then executes `from <package-root-namespace> import *`. For example from `azure-core`, the following would be invoked: `from azure.core import *`.
7878

7979
Following is the command to run this test environment locally.
8080

eng/.docsettings.yml

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ known_content_issues:
124124
- ['sdk/core/azure-mgmt-nspkg/README.rst', 'nspkg and common']
125125
- ['sdk/core/azure-nspkg/README.rst', 'nspkg and common']
126126
- ['sdk/keyvault/azure-keyvault-nspkg/README.md', 'nspkg and common']
127+
- ['sdk/mixedreality/azure-mixedreality-nspkg/README.md', 'nspkg and common']
127128
- ['sdk/search/azure-search-nspkg/README.md', 'nspkg and common']
128129
- ['sdk/storage/azure-storage-blob/samples/README.md', 'nspkg and common']
129130
- ['sdk/storage/azure-storage-file-datalake/samples/README.md', 'nspkg and common']

eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1

+31-37
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr
127127
$fields += "ID"
128128
$fields += "State"
129129
$fields += "System.AssignedTo"
130-
$fields += "Microsoft.VSTS.Common.StateChangeDate"
131130
$fields += "Parent"
132131
$fields += "Language"
133132
$fields += "Package"
@@ -265,19 +264,6 @@ function CreateWorkItem($title, $type, $iteration, $area, $fields, $assignedTo,
265264
return $workItem
266265
}
267266

268-
function ResetWorkItemState($workItem, $resetState = $null, $outputCommand = $true)
269-
{
270-
if (!$resetState -or $resetState -eq "New") {
271-
$resetState = "Next Release Unknown"
272-
}
273-
if ($workItem.fields["System.State"] -ne $resetState)
274-
{
275-
Write-Verbose "Resetting state for [$($workItem.id)] from '$($workItem.fields['System.State'])' to '$resetState'"
276-
return UpdateWorkItem $workItem.id -state $resetState -outputCommand $outputCommand
277-
}
278-
return $workItem
279-
}
280-
281267
function UpdateWorkItem($id, $fields, $title, $state, $assignedTo, $outputCommand = $true)
282268
{
283269
$parameters = $ReleaseDevOpsCommonParameters
@@ -305,6 +291,30 @@ function UpdatePackageWorkItemReleaseState($id, $state, $releaseType, $outputCom
305291
return UpdateWorkItem -id $id -state $state -fields $fields -outputCommand $outputCommand
306292
}
307293

294+
function FindOrCreateClonePackageWorkItem($lang, $pkg, $verMajorMinor, $outputCommand = $false)
295+
{
296+
$workItem = FindPackageWorkItem -lang $lang -packageName $pkg.Package -version $verMajorMinor -includeClosed $true -outputCommand $outputCommand
297+
298+
if (!$workItem) {
299+
$latestVersionItem = FindLatestPackageWorkItem -lang $lang -packageName $pkg.Package -outputCommand $outputCommand
300+
$assignedTo = "me"
301+
if ($latestVersionItem) {
302+
Write-Verbose "Copying data from latest matching [$($latestVersionItem.id)] with version $($latestVersionItem.fields["Custom.PackageVersionMajorMinor"])"
303+
if ($latestVersionItem.fields["System.AssignedTo"]) {
304+
$assignedTo = $latestVersionItem.fields["System.AssignedTo"]["uniqueName"]
305+
}
306+
$pkg.DisplayName = $latestVersionItem.fields["Custom.PackageDisplayName"]
307+
$pkg.ServiceName = $latestVersionItem.fields["Custom.ServiceName"]
308+
if (!$pkg.RepoPath -and $pkg.RepoPath -ne "NA" -and $pkg.fields["Custom.PackageRepoPath"]) {
309+
$pkg.RepoPath = $pkg.fields["Custom.PackageRepoPath"]
310+
}
311+
}
312+
$workItem = CreateOrUpdatePackageWorkItem $lang $pkg $verMajorMinor -existingItem $null -assignedTo $assignedTo -outputCommand $outputCommand
313+
}
314+
315+
return $workItem
316+
}
317+
308318
function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingItem, $assignedTo = $null, $outputCommand = $true)
309319
{
310320
if (!$lang -or !$pkg -or !$verMajorMinor) {
@@ -347,14 +357,18 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
347357
Write-Host "At least field $changedField ($($existingItem.fields[$changedField])) changed so updating."
348358
}
349359

350-
$beforeState = $existingItem.fields["System.State"]
351-
352360
if ($changedField) {
361+
$beforeState = $existingItem.fields["System.State"]
362+
353363
# Need to set to New to be able to update
354364
$existingItem = UpdateWorkItem -id $existingItem.id -fields $fields -title $title -state "New" -assignedTo $assignedTo -outputCommand $outputCommand
355365
Write-Host "[$($existingItem.id)]$lang - $pkgName($verMajorMinor) - Updated"
366+
367+
if ($beforeState -ne $existingItem.fields['System.State']) {
368+
Write-Verbose "Resetting state for [$($existingItem.id)] from '$($existingItem.fields['System.State'])' to '$beforeState'"
369+
$existingItem = UpdateWorkItem $existingItem.id -state $beforeState -outputCommand $outputCommand
370+
}
356371
}
357-
$existingItem = ResetWorkItemState $existingItem $beforeState -outputCommand $outputCommand
358372

359373
$newparentItem = FindOrCreatePackageGroupParent $serviceName $pkgDisplayName -outputCommand $false
360374
UpdateWorkItemParent $existingItem $newParentItem -outputCommand $outputCommand
@@ -363,7 +377,6 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte
363377

364378
$parentItem = FindOrCreatePackageGroupParent $serviceName $pkgDisplayName -outputCommand $false
365379
$workItem = CreateWorkItem $title "Package" "Release" "Release" $fields $assignedTo $parentItem.id -outputCommand $outputCommand
366-
$workItem = ResetWorkItemState $workItem -outputCommand $outputCommand
367380
Write-Host "[$($workItem.id)]$lang - $pkgName($verMajorMinor) - Created"
368381
return $workItem
369382
}
@@ -752,25 +765,6 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions)
752765
"value": "$shippedPackages"
753766
}
754767
"@
755-
756-
# If we shipped a version after we set "In Release" state then reset the state to "Next Release Unknown"
757-
if ($pkgWorkItem.fields["System.State"] -eq "In Release")
758-
{
759-
$lastShippedDate = [DateTime]$newShippedVersions[0].Date
760-
$markedInReleaseDate = ([DateTime]$pkgWorkItem.fields["Microsoft.VSTS.Common.StateChangeDate"])
761-
762-
# We just shipped so lets set the state to "Next Release Unknown"
763-
if ($markedInReleaseDate -le $lastShippedDate)
764-
{
765-
$fieldUpdates += @'
766-
{
767-
"op": "replace",
768-
"path": "/fields/State",
769-
"value": "Next Release Unknown"
770-
}
771-
'@
772-
}
773-
}
774768
}
775769

776770
# Full merged version set

eng/common/scripts/Prepare-Release.ps1

+60-51
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,67 @@
22

33
[CmdletBinding()]
44
param(
5-
[Parameter(Mandatory=$true)]
6-
[string]$PackageName,
7-
[string]$ServiceDirectory,
8-
[string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy"
9-
[string]$BuildType # For Java
5+
[Parameter(Mandatory = $true)]
6+
[string]$PackageName,
7+
[string]$ServiceDirectory,
8+
[string]$ReleaseDate # Pass Date in the form MM/dd/yyyy"
109
)
10+
Set-StrictMode -Version 3
1111

1212
. ${PSScriptRoot}\common.ps1
1313

1414
function Get-ReleaseDay($baseDate)
1515
{
16-
# Find first friday
17-
while ($baseDate.DayOfWeek -ne 5)
18-
{
19-
$baseDate = $baseDate.AddDays(1)
20-
}
21-
22-
# Go to Tuesday
23-
$baseDate = $baseDate.AddDays(4)
24-
25-
return $baseDate;
16+
# Find first friday
17+
while ($baseDate.DayOfWeek -ne 5)
18+
{
19+
$baseDate = $baseDate.AddDays(1)
20+
}
21+
22+
# Go to Tuesday
23+
$baseDate = $baseDate.AddDays(4)
24+
25+
return $baseDate;
2626
}
2727

2828
$ErrorPreference = 'Stop'
2929

3030
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $serviceDirectory
3131

32+
if (!$packageProperties)
33+
{
34+
Write-Error "Could not find a package with name [ $packageName ], please verify the package name matches the exact name."
35+
exit 1
36+
}
37+
38+
Write-Host "Package Name [ $($packageProperties.Name) ]"
3239
Write-Host "Source directory [ $serviceDirectory ]"
3340

3441
if (!$ReleaseDate)
3542
{
36-
$currentDate = Get-Date
37-
$thisMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1));
38-
$nextMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1).AddMonths(1));
39-
40-
if ($thisMonthReleaseDate -ge $currentDate)
41-
{
42-
# On track for this month release
43-
$ParsedReleaseDate = $thisMonthReleaseDate
44-
}
45-
elseif ($currentDate.Day -lt 15)
46-
{
47-
# Catching up to this month release
48-
$ParsedReleaseDate = $currentDate
49-
}
50-
else
51-
{
52-
# Next month release
53-
$ParsedReleaseDate = $nextMonthReleaseDate
54-
}
43+
$currentDate = Get-Date
44+
$thisMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1));
45+
$nextMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1).AddMonths(1));
46+
47+
if ($thisMonthReleaseDate -ge $currentDate)
48+
{
49+
# On track for this month release
50+
$ParsedReleaseDate = $thisMonthReleaseDate
51+
}
52+
elseif ($currentDate.Day -lt 15)
53+
{
54+
# Catching up to this month release
55+
$ParsedReleaseDate = $currentDate
56+
}
57+
else
58+
{
59+
# Next month release
60+
$ParsedReleaseDate = $nextMonthReleaseDate
61+
}
5562
}
5663
else
5764
{
58-
$ParsedReleaseDate = [datetime]$ReleaseDate
65+
$ParsedReleaseDate = [datetime]$ReleaseDate
5966
}
6067

6168
$releaseDateString = $ParsedReleaseDate.ToString("MM/dd/yyyy")
@@ -70,40 +77,42 @@ $newVersion = Read-Host -Prompt "Input the new version, or press Enter to use us
7077

7178
if (!$newVersion)
7279
{
73-
$newVersion = $currentProjectVersion;
80+
$newVersion = $currentProjectVersion;
7481
}
7582

7683
$newVersionParsed = [AzureEngSemanticVersion]::ParseVersionString($newVersion)
7784
if ($null -eq $newVersionParsed)
7885
{
79-
Write-Error "Invalid version $newVersion. Version must follow standard SemVer rules, see https://aka.ms/azsdk/engsys/packageversioning"
80-
exit 1
86+
Write-Error "Invalid version $newVersion. Version must follow standard SemVer rules, see https://aka.ms/azsdk/engsys/packageversioning"
87+
exit 1
8188
}
8289

8390
if (Test-Path "Function:SetPackageVersion")
8491
{
85-
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion -ServiceDirectory $serviceDirectory -ReleaseDate $releaseDateString `
86-
-BuildType $BuildType -GroupId $packageProperties.Group
92+
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion -ServiceDirectory $serviceDirectory -ReleaseDate $releaseDateString `
93+
-PackageProperties $packageProperties
8794
}
8895
else
8996
{
90-
LogError "The function 'SetPackageVersion' was not found.`
97+
LogError "The function 'SetPackageVersion' was not found.`
9198
Make sure it is present in eng/scripts/Language-Settings.ps1.`
9299
See https://github.com/Azure/azure-sdk-tools/blob/master/doc/common/common_engsys.md#code-structure"
93-
exit 1
100+
exit 1
94101
}
95102

96103
&$EngCommonScriptsDir/Update-DevOps-Release-WorkItem.ps1 `
97-
-language $LanguageDisplayName `
98-
-packageName $packageProperties.Name `
99-
-version $newVersion `
100-
-plannedDate $releaseDateString `
101-
-packageRepoPath $packageProperties.serviceDirectory
104+
-language $LanguageDisplayName `
105+
-packageName $packageProperties.Name `
106+
-version $newVersion `
107+
-plannedDate $releaseDateString `
108+
-packageRepoPath $packageProperties.serviceDirectory `
109+
-packageType $packageProperties.SDKType `
110+
-packageNewLibrary $packageProperties.IsNewSDK
102111

103112
git diff -s --exit-code $packageProperties.DirectoryPath
104113
if ($LASTEXITCODE -ne 0)
105114
{
106-
git status
107-
Write-Host "Some changes were made to the repo source" -ForegroundColor Green
108-
Write-Host "Submit a pull request with the necessary changes to the repo" -ForegroundColor Green
109-
}
115+
git status
116+
Write-Host "Some changes were made to the repo source" -ForegroundColor Green
117+
Write-Host "Submit a pull request with the necessary changes to the repo" -ForegroundColor Green
118+
}

eng/common/scripts/common.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ if (Test-Path $EngScriptsLanguageSettings) {
2525
. $EngScriptsLanguageSettings
2626
}
2727

28-
if (-not $LanguageShort)
28+
if (!(Get-Variable -Name "LangaugeShort" -ValueOnly -ErrorAction "Ignore"))
2929
{
3030
$LangaugeShort = $Language
3131
}
3232

33-
if (-not $LanguageDisplayName)
33+
if (!(Get-Variable -Name "LanguageDisplayName" -ValueOnly -ErrorAction "Ignore"))
3434
{
3535
$LanguageDisplayName = $Language
3636
}

eng/common/scripts/logging.ps1

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
if (-not $isDevOpsRun)
2-
{
3-
$isDevOpsRun = ($null -ne $env:SYSTEM_TEAMPROJECTID)
4-
}
1+
$isDevOpsRun = ($null -ne $env:SYSTEM_TEAMPROJECTID)
52

63
function LogWarning
74
{
@@ -37,4 +34,4 @@ function LogDebug
3734
{
3835
Write-Debug "$args"
3936
}
40-
}
37+
}

eng/pipelines/aggregate-reports.yml

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
# Used for generating baseline file.
5555
# GdnBreakOutputBaselineFile: python
5656
# GdnBreakOutputBaseline: baseline
57+
continueOnError: true
5758
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
5859
displayName: 'Publish Security Analysis Logs'
5960
continueOnError: true

eng/pipelines/templates/stages/archetype-python-release.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,15 @@ stages:
286286
$packageDirectory = "${{artifact.name}}".Replace("_", "-")
287287
echo "##vso[task.setvariable variable=Package.Name]$packageDirectory"
288288
- pwsh: |
289-
$fileCount = (Get-ChildItem $(Pipeline.Workspace)/${{parameters.ArtifactName}}/$packageDirectory | Measure-Object).Count
289+
$fileCount = (Get-ChildItem $(Pipeline.Workspace)/${{parameters.ArtifactName}}/$(Package.Name) | ? {$_.Name -match "-[0-9]*.[0-9]*.[0-9]*a[0-9]*" } | Measure-Object).Count
290+
290291
if ($fileCount -eq 0) {
291292
Write-Host "No alpha packages for ${{artifact.safeName}} to publish."
292293
exit 0
293294
}
294295
295-
twine upload --repository $(DevFeedName) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/${{parameters.ArtifactName}}/$(Package.Name)/*a*.whl
296+
twine upload --repository $(DevFeedName) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/${{parameters.ArtifactName}}/$(Package.Name)/*-*a*.whl
296297
echo "Uploaded whl to devops feed $(DevFeedName)"
297-
twine upload --repository $(DevFeedName) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/${{parameters.ArtifactName}}/$(Package.Name)/*a*.zip
298+
twine upload --repository $(DevFeedName) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/${{parameters.ArtifactName}}/$(Package.Name)/*-*a*.zip
298299
echo "Uploaded sdist to devops feed $(DevFeedName)"
299300
displayName: 'Publish ${{artifact.name}} alpha package'

0 commit comments

Comments
 (0)