Skip to content

Commit 2485750

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-python into regenerate_keys
* 'master' of https://github.com/Azure/azure-sdk-for-python: re-apply updates after resetting master (Azure#12771) Sync eng/common directory with azure-sdk-tools repository (Azure#12745) Enable bandit for servicebus (Azure#12763) Skip pypy3 for service bus CI pipeline (Azure#12732) Update CODEOWNERS (Azure#12765) updated tox file (Azure#11087) Updating to match Microsoft recommended template (Azure#11045) [text analytics] update version in master (Azure#12749) Explicitly stringify message prints in samples per manual doc pass recommendation. (Azure#12709) Run only analyse dependency step for aggregate report (Azure#12728) VSCodeCredential supports Python 2.7 on Windows (Azure#12731) Enable bandit (Azure#12722) Move InteractiveCredential to a new module (Azure#12706)
2 parents 6520b29 + ea61c6d commit 2485750

Some content is hidden

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

45 files changed

+763
-288
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/sdk/eventhub/ @annatisch @yunhaoling @YijunXieMS
2424

2525
# PRLabel: %Storage
26-
/sdk/storage/ @amishra-dev @zezha-msft @annatisch @rakshith91 @xiafu-msft
26+
/sdk/storage/ @amishra-dev @zezha-msft @annatisch @rakshith91 @xiafu-msft @kasobol-msft
2727

2828
/sdk/applicationinsights/ @alexeldeib
2929

NOTICE.txt

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
This file list any third-party libraries or other resources that may be
2-
distributed under licenses different than the Azure SDK for Python software.
1+
NOTICES AND INFORMATION
2+
Do Not Translate or Localize
33

4-
In the event that we accidentally failed to list a required notice, please
5-
bring it to our attention by opening an issue.
4+
This software incorporates material from third parties. Microsoft makes certain
5+
open source code available at https://3rdpartysource.microsoft.com, or you may
6+
send a check or money order for US $5.00, including the product name, the open
7+
source component name, and version number, to:
68

7-
The attached notices are provided for information only.
9+
Source Code Compliance Team
10+
Microsoft Corporation
11+
One Microsoft Way
12+
Redmond, WA 98052
13+
USA
14+
15+
Notwithstanding any other terms, you may reverse engineer this software to the
16+
extent required to debug changes to any libraries licensed under the GNU Lesser
17+
General Public License.

eng/common/TestResources/New-TestResources.ps1

+20-4
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,21 @@ if ($ProvisionerApplicationId) {
154154
$subscriptionArgs = if ($SubscriptionId) {
155155
@{SubscriptionId = $SubscriptionId}
156156
}
157+
else {
158+
@{}
159+
}
157160

158161
$provisionerAccount = Retry {
159162
Connect-AzAccount -Force:$Force -Tenant $TenantId -Credential $provisionerCredential -ServicePrincipal -Environment $Environment @subscriptionArgs
160163
}
161164

162165
$exitActions += {
163166
Write-Verbose "Logging out of service principal '$($provisionerAccount.Context.Account)'"
164-
$null = Disconnect-AzAccount -AzureContext $provisionerAccount.Context
167+
168+
# Only attempt to disconnect if the -WhatIf flag was not set. Otherwise, this call is not necessary and will fail.
169+
if ($PSCmdlet.ShouldProcess($ProvisionerApplicationId)) {
170+
$null = Disconnect-AzAccount -AzureContext $provisionerAccount.Context
171+
}
165172
}
166173
}
167174

@@ -176,7 +183,6 @@ if ($TestApplicationId -and !$TestApplicationOid) {
176183
}
177184
}
178185

179-
180186
# If the ServiceDirectory is an absolute path use the last directory name
181187
# (e.g. D:\foo\bar\ -> bar)
182188
$serviceName = if (Split-Path -IsAbsolute $ServiceDirectory) {
@@ -229,6 +235,13 @@ if ($resourceGroup.ProvisioningState -eq 'Succeeded') {
229235
# New-AzResourceGroup would've written an error and stopped the pipeline by default anyway.
230236
Write-Verbose "Successfully created resource group '$($resourceGroup.ResourceGroupName)'"
231237
}
238+
elseif (($resourceGroup -eq $null) -and (-not $PSCmdlet.ShouldProcess($resourceGroupName))) {
239+
# If the -WhatIf flag was passed, there will be no resource group created. Fake it.
240+
$resourceGroup = [PSCustomObject]@{
241+
ResourceGroupName = $resourceGroupName
242+
Location = $Location
243+
}
244+
}
232245

233246
# Populate the template parameters and merge any additional specified.
234247
$templateParameters = @{
@@ -299,6 +312,9 @@ foreach ($templateFile in $templateFiles) {
299312
"$($serviceDirectoryPrefix)RESOURCE_GROUP" = $resourceGroup.ResourceGroupName;
300313
"$($serviceDirectoryPrefix)LOCATION" = $resourceGroup.Location;
301314
"$($serviceDirectoryPrefix)ENVIRONMENT" = $context.Environment.Name;
315+
"$($serviceDirectoryPrefix)AZURE_AUTHORITY_HOST" = $context.Environment.ActiveDirectoryAuthority;
316+
"$($serviceDirectoryPrefix)RESOURCE_MANAGER_URL" = $context.Environment.ResourceManagerUrl;
317+
"$($serviceDirectoryPrefix)SERVICE_MANAGEMENT_URL" = $context.Environment.ServiceManagementUrl;
302318
}
303319

304320
foreach ($key in $deployment.Outputs.Keys) {
@@ -331,7 +347,7 @@ foreach ($templateFile in $templateFiles) {
331347
}
332348
else
333349
{
334-
350+
335351
if (!$CI) {
336352
# Write an extra new line to isolate the environment variables for easy reading.
337353
Log "Persist the following environment variables based on your detected shell ($shell):`n"
@@ -340,7 +356,7 @@ foreach ($templateFile in $templateFiles) {
340356
foreach ($key in $deploymentOutputs.Keys)
341357
{
342358
$value = $deploymentOutputs[$key]
343-
359+
344360
if ($CI) {
345361
# Treat all ARM template output variables as secrets since "SecureString" variables do not set values.
346362
# In order to mask secrets but set environment variables for any given ARM template, we set variables twice as shown below.
+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Common Changelog Operations
2+
3+
$RELEASE_TITLE_REGEX = "(?<releaseNoteTitle>^\#+.*(?<version>\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s(?<releaseStatus>\(Unreleased\)|\(\d{4}-\d{2}-\d{2}\)))?)"
4+
5+
# Returns a Collection of changeLogEntry object containing changelog info for all version present in the gived CHANGELOG
6+
function Get-ChangeLogEntries {
7+
param (
8+
[Parameter(Mandatory = $true)]
9+
[String]$ChangeLogLocation
10+
)
11+
12+
$changeLogEntries = @{}
13+
if (!(Test-Path $ChangeLogLocation)) {
14+
Write-Error "ChangeLog[${ChangeLogLocation}] does not exist"
15+
return $null
16+
}
17+
18+
try {
19+
$contents = Get-Content $ChangeLogLocation
20+
# walk the document, finding where the version specifiers are and creating lists
21+
$changeLogEntry = $null
22+
foreach ($line in $contents) {
23+
if ($line -match $RELEASE_TITLE_REGEX) {
24+
$changeLogEntry = [pscustomobject]@{
25+
ReleaseVersion = $matches["version"]
26+
ReleaseStatus = $matches["releaseStatus"]
27+
ReleaseTitle = $line
28+
ReleaseContent = @() # Release content without the version title
29+
}
30+
$changeLogEntries[$changeLogEntry.ReleaseVersion] = $changeLogEntry
31+
}
32+
else {
33+
if ($changeLogEntry) {
34+
$changeLogEntry.ReleaseContent += $line
35+
}
36+
}
37+
}
38+
}
39+
catch {
40+
Write-Host "Error parsing $ChangeLogLocation."
41+
Write-Host $_.Exception.Message
42+
}
43+
return $changeLogEntries
44+
}
45+
46+
# Returns single changeLogEntry object containing the ChangeLog for a particular version
47+
function Get-ChangeLogEntry {
48+
param (
49+
[Parameter(Mandatory = $true)]
50+
[String]$ChangeLogLocation,
51+
[Parameter(Mandatory = $true)]
52+
[String]$VersionString
53+
)
54+
$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $ChangeLogLocation
55+
56+
if ($changeLogEntries -and $changeLogEntries.ContainsKey($VersionString)) {
57+
return $changeLogEntries[$VersionString]
58+
}
59+
return $null
60+
}
61+
62+
#Returns the changelog for a particular version as string
63+
function Get-ChangeLogEntryAsString {
64+
param (
65+
[Parameter(Mandatory = $true)]
66+
[String]$ChangeLogLocation,
67+
[Parameter(Mandatory = $true)]
68+
[String]$VersionString
69+
)
70+
71+
$changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString
72+
return ChangeLogEntryAsString $changeLogEntry
73+
}
74+
75+
function ChangeLogEntryAsString($changeLogEntry) {
76+
if (!$changeLogEntry) {
77+
return "[Missing change log entry]"
78+
}
79+
[string]$releaseTitle = $changeLogEntry.ReleaseTitle
80+
[string]$releaseContent = $changeLogEntry.ReleaseContent -Join [Environment]::NewLine
81+
return $releaseTitle, $releaseContent -Join [Environment]::NewLine
82+
}
83+
84+
function Confirm-ChangeLogEntry {
85+
param (
86+
[Parameter(Mandatory = $true)]
87+
[String]$ChangeLogLocation,
88+
[Parameter(Mandatory = $true)]
89+
[String]$VersionString,
90+
[boolean]$ForRelease = $false
91+
)
92+
93+
$changeLogEntry = Get-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString
94+
95+
if (!$changeLogEntry) {
96+
Write-Error "ChangeLog[${ChangeLogLocation}] does not have an entry for version ${VersionString}."
97+
return $false
98+
}
99+
100+
Write-Host "Found the following change log entry for version '${VersionString}' in [${ChangeLogLocation}]."
101+
Write-Host "-----"
102+
Write-Host (ChangeLogEntryAsString $changeLogEntry)
103+
Write-Host "-----"
104+
105+
if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus)) {
106+
Write-Error "Entry does not have a correct release status. Please ensure the status is set to a date '(yyyy-MM-dd)' or '(Unreleased)' if not yet released."
107+
return $false
108+
}
109+
110+
if ($ForRelease -eq $True) {
111+
if ($changeLogEntry.ReleaseStatus -eq "(Unreleased)") {
112+
Write-Error "Entry has no release date set. Please ensure to set a release date with format 'yyyy-MM-dd'."
113+
return $false
114+
}
115+
116+
if ([System.String]::IsNullOrWhiteSpace($changeLogEntry.ReleaseContent)) {
117+
Write-Error "Entry has no content. Please ensure to provide some content of what changed in this version."
118+
return $false
119+
}
120+
}
121+
return $true
122+
}

0 commit comments

Comments
 (0)