Skip to content

Commit fcc6941

Browse files
committed
Merge branch 'main' into myao/sync-sb3
# Conflicts: # .github/CODEOWNERS # sdk/appcomplianceautomation/azure-resourcemanager-appcomplianceautomation/pom.xml # sdk/cognitiveservices/ms-azure-cs-textanalytics/pom.xml # sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml # sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml # sdk/keyvault/microsoft-azure-keyvault/pom.xml # sdk/loganalytics/microsoft-azure-loganalytics/pom.xml # sdk/maps/azure-maps-elevation/pom.xml # sdk/mobilenetwork/azure-resourcemanager-mobilenetwork/pom.xml # sdk/purview/azure-analytics-purview-catalog/pom.xml # sdk/spring/ci.monitor.yml # sdk/spring/ci.yml # sdk/storage/microsoft-azure-storage-blob/pom.xml # sdk/webpubsub/azure-messaging-webpubsub/pom.xml
2 parents 39b7543 + bebe90e commit fcc6941

File tree

4,824 files changed

+165669
-264157
lines changed

Some content is hidden

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

4,824 files changed

+165669
-264157
lines changed

.github/CODEOWNERS_baseline_errors.txt

Lines changed: 76 additions & 95 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ Merging Pull Requests (for project contributors with write access)
5050
- add `MAVEN_HOME` to environment variables
5151

5252
>**Note:** If you ran into "long path" issue on `Windows`, enable paths longer than 260 characters by: <br><br>
53-
1.- Run this as Administrator on a command prompt:<br>
53+
1.- Run this as Administrator on a command prompt:<br>
5454
`REG ADD HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1`<br>*(might need to type `yes` to override key if it already exists)*<br><br>
5555
2.- Set up `git` by running:<br> `git config --system core.longpaths true`
5656
5757
### Building and Unit Testing
5858

5959
Refer to the [build wiki](https://github.com/Azure/azure-sdk-for-java/wiki/Building) for learning how to build Java SDKs
60-
and the [unit testing wiki](https://github.com/Azure/azure-sdk-for-java/wiki/Unit-Testing) for guidelines on unit
60+
and the [unit testing wiki](https://github.com/Azure/azure-sdk-for-java/wiki/Unit-Testing) for guidelines on unit
6161
testing.
6262

6363
### Live testing
@@ -93,7 +93,7 @@ When building locally you might run into a Checkstyle such as the following:
9393

9494
```
9595
Execution default of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0:check failed:
96-
Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0 or one of its dependencies could not be resolved:
96+
Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0 or one of its dependencies could not be resolved:
9797
Could not find artifact com.azure:sdk-build-tools:jar:1.0.0 in ossrh (https://oss.sonatype.org/content/repositories/snapshots/)
9898
```
9999

@@ -115,6 +115,29 @@ The dependency-version should be set to the most recent released version and the
115115

116116
Note: In the case of a new artifact both versions will be the same. In the case of a released artifact, the dependecny version should be the latest released version.
117117

118+
### Supported GroupIds and publishing
119+
120+
We no longer publish directly to Maven Central, any publishing is done through ESRP. Libraries published need to conform to one of the groupIds that we can publish to. Here is the list of accepted groupdIs:
121+
122+
- "com.microsoft"
123+
- "com.azure.*"
124+
- "com.azure"
125+
- "com.microsoft.azure"
126+
- "com.microsoft.azure.cognitiveservices"
127+
- "com.microsoft.azure.functions"
128+
- "com.microsoft.azure.kusto"
129+
- "com.microsoft.azure.sdk.iot"
130+
- "com.microsoft.azure.sdk.iot.provisioning"
131+
- "com.microsoft.commondatamodel"
132+
- "com.windowsazure"
133+
- "com.microsoft.sqlserver"
134+
- "com.microsoft.spring"
135+
- "com.microsoft.servicefabric"
136+
- "com.microsoft.rest"
137+
- "io.clientcore"
138+
139+
Note: This list will be replaced with a link to a page created by ESRP providing a UI where GroupIds can be cheked and new ones requested if needed.
140+
118141
### Libraries vs External Dependencies
119142

120143
Libraries refer to things that are built and released as part of the Azure SDK. Libraries have a current version and a dependency version.
@@ -193,7 +216,7 @@ After the unreleased version of `com.azure:azure-core` was released but before `
193216

194217
For general packaging versioning policies see [Package Versioning](https://azure.github.io/azure-sdk/policies_releases.html#package-versioning) and see [Java](https://azure.github.io/azure-sdk/policies_releases.html#java) for specific rules used in this repo.
195218

196-
While some Java projects use SNAPSHOT versions for nightly builds, we have opted not to use that convention because it has proven to be very unreliable in our scenarios. For example, if we use SNAPSHOT versions in our pom.xml files that usually ends up becoming viral throughout our entire repo and we want to more tightly control our versioning, especially our dependency versioning. On top of the viral nature, we have experienced a lot of network reliability issues when consuming SNAPSHOT versions from Maven central so we want to avoid this reliability issue in our build pipelines.
219+
While some Java projects use SNAPSHOT versions for nightly builds, we have opted not to use that convention because it has proven to be very unreliable in our scenarios. For example, if we use SNAPSHOT versions in our pom.xml files that usually ends up becoming viral throughout our entire repo and we want to more tightly control our versioning, especially our dependency versioning. On top of the viral nature, we have experienced a lot of network reliability issues when consuming SNAPSHOT versions from Maven central so we want to avoid this reliability issue in our build pipelines.
197220

198221
Given we don't use SNAPSHOT versions in our pom.xml files we generally have the version currently under development committed to the repo in the pom.xml file. This means if you are looking at our active development code for the version you will see a version that is not yet published to Maven central. If you want to try out our packages under development, you should look for our latest alpha build (see Dev Feed section below).
199222

common/smoke-tests/smoke-test-dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ jobs:
5656
Java 8 MacOS (AzureCloud):
5757
JavaTestVersion: '1.8'
5858
Pool: Azure Pipelines
59-
OSVmImage: macos-11
59+
OSVmImage: macos-latest
6060
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
6161
ArmTemplateParameters: $(azureCloudArmParameters)
6262
PomFile: common/smoke-tests/pom.xml
6363
ServiceDirectory: '$(Build.SourcesDirectory)/common/smoke-tests/'
6464
Java LTS MacOS (AzureCloud):
6565
JavaTestVersion: '1.11'
6666
Pool: Azure Pipelines
67-
OSVmImage: macos-11
67+
OSVmImage: macos-latest
6868
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
6969
ArmTemplateParameters: $(azureCloudArmParameters)
7070
PomFile: common/smoke-tests/pom.xml

eng/code-quality-reports/src/main/resources/revapi/revapi.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
{
512512
"regex": true,
513513
"code": "java\\.annotation\\.(attributeRemoved|attributeAdded)",
514-
"old": ".*? com\\.azure\\.resourcemanager\\.(cosmos|network)\\.models.*",
514+
"old": ".*? com\\.azure\\.resourcemanager\\.(cosmos|network|mobilenetwork)\\.models.*",
515515
"justification": "Jackson annotation changed."
516516
},
517517
{
@@ -549,6 +549,27 @@
549549
"code": "java.method.removed",
550550
"old": "method com.azure.resourcemanager.cosmos.models.ServiceResourceCreateUpdateParameters com.azure.resourcemanager.cosmos.models.ServiceResourceCreateUpdateParameters::withServiceType(com.azure.resourcemanager.cosmos.models.ServiceType)",
551551
"justification": "The property flatten disabled due to model changed to polymorphic."
552+
},
553+
{
554+
"regex": true,
555+
"code" : "java\\.annotation\\.removed",
556+
"old" : ".*? com\\.azure\\.communication\\.phonenumbers\\.models.*",
557+
"new" : ".*? com\\.azure\\.communication\\.phonenumbers\\.models.*",
558+
"justification": "Migration to azure-json"
559+
},
560+
{
561+
"regex": true,
562+
"code" : "java\\.annotation\\.removed",
563+
"old" : ".*? com\\.azure\\.messaging\\.webpubsub\\.models.*",
564+
"new" : ".*? com\\.azure\\.messaging\\.webpubsub\\.models.*",
565+
"justification": "Migration to azure-json"
566+
},
567+
{
568+
"regex": true,
569+
"code" : "java\\.annotation\\.removed",
570+
"old" : ".*? com\\.azure\\.messaging\\.webpubsub\\.client\\.models.*",
571+
"new" : ".*? com\\.azure\\.messaging\\.webpubsub\\.client\\.models.*",
572+
"justification": "Migration to azure-json"
552573
}
553574
]
554575
}

eng/common/TestResources/New-TestResources.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ param (
106106

107107
. $PSScriptRoot/SubConfig-Helpers.ps1
108108

109+
$azsdkPipelineVnet = "/subscriptions/a18897a6-7e44-457d-9260-f2854c0aca42/resourceGroups/azsdk-pools/providers/Microsoft.Network/virtualNetworks/azsdk-pipeline-vnet-wus"
110+
$azsdkPipelineSubnets = @(
111+
($azsdkPipelineVnet + "/subnets/pipeline-subnet-ubuntu-1804-general"),
112+
($azsdkPipelineVnet + "/subnets/pipeline-subnet-ubuntu-2004-general"),
113+
($azsdkPipelineVnet + "/subnets/pipeline-subnet-ubuntu-2204-general"),
114+
($azsdkPipelineVnet + "/subnets/pipeline-subnet-win-2019-general"),
115+
($azsdkPipelineVnet + "/subnets/pipeline-subnet-win-2022-general")
116+
)
117+
109118
if (!$ServicePrincipalAuth) {
110119
# Clear secrets if not using Service Principal auth. This prevents secrets
111120
# from being passed to pre- and post-scripts.
@@ -743,13 +752,15 @@ try {
743752
if ($ProvisionerApplicationOid) {
744753
$templateParameters["provisionerApplicationOid"] = "$ProvisionerApplicationOid"
745754
}
746-
747755
if ($TenantId) {
748756
$templateParameters.Add('tenantId', $TenantId)
749757
}
750758
if ($TestApplicationSecret -and $ServicePrincipalAuth) {
751759
$templateParameters.Add('testApplicationSecret', $TestApplicationSecret)
752760
}
761+
if ($CI -and $Environment -eq 'AzureCloud') {
762+
$templateParameters.Add('azsdkPipelineSubnetList', $azsdkPipelineSubnets)
763+
}
753764

754765
$defaultCloudParameters = LoadCloudConfig $Environment
755766
MergeHashes $defaultCloudParameters $(Get-Variable templateParameters)

eng/common/TestResources/SubConfig-Helpers.ps1

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function ShouldMarkValueAsSecret([string]$serviceName, [string]$key, [string]$va
103103

104104
function SetSubscriptionConfiguration([object]$subscriptionConfiguration)
105105
{
106-
foreach($pair in $subscriptionConfiguration.GetEnumerator()) {
106+
foreach ($pair in $subscriptionConfiguration.GetEnumerator()) {
107107
if ($pair.Value -is [Hashtable]) {
108108
foreach($nestedPair in $pair.Value.GetEnumerator()) {
109109
# Mark values as secret so we don't print json blobs containing secrets in the logs.
@@ -126,36 +126,32 @@ function SetSubscriptionConfiguration([object]$subscriptionConfiguration)
126126
}
127127
}
128128

129-
Write-Host ($subscriptionConfiguration | ConvertTo-Json)
130-
$serialized = $subscriptionConfiguration | ConvertTo-Json -Compress
131-
Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized"
129+
return $subscriptionConfiguration
132130
}
133131

134132
function UpdateSubscriptionConfiguration([object]$subscriptionConfigurationBase, [object]$subscriptionConfiguration)
135133
{
136-
foreach ($pair in $subscriptionConfiguration.GetEnumerator()) {
137-
if ($pair.Value -is [Hashtable]) {
138-
if (!$subscriptionConfigurationBase.ContainsKey($pair.Name)) {
139-
$subscriptionConfigurationBase[$pair.Name] = @{}
140-
}
141-
foreach($nestedPair in $pair.Value.GetEnumerator()) {
142-
# Mark values as secret so we don't print json blobs containing secrets in the logs.
143-
# Prepend underscore to the variable name, so we can still access the variable names via environment
144-
# variables if they get set subsequently.
145-
if (ShouldMarkValueAsSecret "AZURE_" $nestedPair.Name $nestedPair.Value) {
146-
Write-Host "##vso[task.setvariable variable=_$($nestedPair.Name);issecret=true;]$($nestedPair.Value)"
147-
}
148-
$subscriptionConfigurationBase[$pair.Name][$nestedPair.Name] = $nestedPair.Value
149-
}
150-
} else {
151-
if (ShouldMarkValueAsSecret "AZURE_" $pair.Name $pair.Value) {
152-
Write-Host "##vso[task.setvariable variable=_$($pair.Name);issecret=true;]$($pair.Value)"
134+
foreach ($pair in $subscriptionConfiguration.GetEnumerator()) {
135+
if ($pair.Value -is [Hashtable]) {
136+
if (!$subscriptionConfigurationBase.ContainsKey($pair.Name)) {
137+
$subscriptionConfigurationBase[$pair.Name] = @{}
138+
}
139+
foreach($nestedPair in $pair.Value.GetEnumerator()) {
140+
# Mark values as secret so we don't print json blobs containing secrets in the logs.
141+
# Prepend underscore to the variable name, so we can still access the variable names via environment
142+
# variables if they get set subsequently.
143+
if (ShouldMarkValueAsSecret "AZURE_" $nestedPair.Name $nestedPair.Value) {
144+
Write-Host "##vso[task.setvariable variable=_$($nestedPair.Name);issecret=true;]$($nestedPair.Value)"
153145
}
154-
$subscriptionConfigurationBase[$pair.Name] = $pair.Value
146+
$subscriptionConfigurationBase[$pair.Name][$nestedPair.Name] = $nestedPair.Value
155147
}
148+
} else {
149+
if (ShouldMarkValueAsSecret "AZURE_" $pair.Name $pair.Value) {
150+
Write-Host "##vso[task.setvariable variable=_$($pair.Name);issecret=true;]$($pair.Value)"
151+
}
152+
$subscriptionConfigurationBase[$pair.Name] = $pair.Value
156153
}
154+
}
157155

158-
$serialized = $subscriptionConfigurationBase | ConvertTo-Json -Compress
159-
Write-Host ($subscriptionConfigurationBase | ConvertTo-Json)
160-
Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized"
156+
return $subscriptionConfigurationBase
161157
}

eng/common/TestResources/build-test-resource-config.yml

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,52 @@ parameters:
99
- name: EnvVars
1010
type: object
1111
default: null
12+
- name: SubscriptionConfigurationFilePaths
13+
type: object
14+
default: null
1215

1316
steps:
14-
- ${{ if parameters.SubscriptionConfiguration }}:
15-
- pwsh: |
16-
$config = @'
17-
${{ parameters.SubscriptionConfiguration }}
18-
'@ | ConvertFrom-Json -AsHashtable
19-
20-
. ./eng/common/TestResources/SubConfig-Helpers.ps1
21-
SetSubscriptionConfiguration $config
22-
displayName: Initialize SubscriptionConfiguration variable
23-
${{ if parameters.EnvVars }}:
24-
env: ${{ parameters.EnvVars }}
25-
26-
- ${{ if parameters.SubscriptionConfigurations }}:
27-
- pwsh: |
28-
Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]{}"
29-
displayName: Initialize SubscriptionConfiguration variable for merging
30-
condition: eq(variables['SubscriptionConfiguration'], '')
31-
32-
- ${{ each config in parameters.SubscriptionConfigurations }}:
33-
- pwsh: |
34-
$configBase = @'
35-
$(SubscriptionConfiguration)
36-
'@ | ConvertFrom-Json -AsHashtable
37-
$config = @'
38-
${{ config }}
39-
'@ | ConvertFrom-Json -AsHashtable
40-
41-
. ./eng/common/TestResources/SubConfig-Helpers.ps1
42-
UpdateSubscriptionConfiguration $configBase $config
43-
44-
displayName: Merge Test Resource Configurations
45-
${{ if parameters.EnvVars }}:
46-
env: ${{ parameters.EnvVars }}
17+
- pwsh: |
18+
. ./eng/common/TestResources/SubConfig-Helpers.ps1
19+
20+
$finalConfig = @{}
21+
$baseSubConfigRaw = @'
22+
${{ parameters.SubscriptionConfiguration }}
23+
'@.Trim()
24+
if ($baseSubConfigRaw) {
25+
$baseSubConfig = $baseSubConfigRaw | ConvertFrom-Json -AsHashtable
26+
27+
Write-Host "Setting base sub config"
28+
$finalConfig = SetSubscriptionConfiguration $baseSubConfig
29+
}
30+
31+
$subConfigJsonsRaw = @'
32+
${{ convertToJson(parameters.SubscriptionConfigurations) }}
33+
'@.Trim() -replace '"{', '{' -replace '}"', '}'
34+
35+
if ($subConfigJsonsRaw) {
36+
$subConfigs = $subConfigJsonsRaw | ConvertFrom-Json -AsHashtable
37+
38+
foreach ($subConfig in $subConfigs) {
39+
Write-Host "Merging sub config from list"
40+
$finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig
41+
}
42+
}
43+
44+
$subConfigFilesRaw = @'
45+
${{ convertToJson(parameters.SubscriptionConfigurationFilePaths) }}
46+
'@.Trim()
47+
48+
if ($subConfigFilesRaw) {
49+
$subConfigFiles = $subConfigFilesRaw | ConvertFrom-Json -AsHashtable
50+
foreach ($file in $subConfigFiles) {
51+
Write-Host "Merging sub config from file: $file"
52+
$subConfig = Get-Content $file | ConvertFrom-Json -AsHashtable
53+
$finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig
54+
}
55+
}
56+
57+
Write-Host ($finalConfig | ConvertTo-Json)
58+
$serialized = $finalConfig | ConvertTo-Json -Compress
59+
Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized"
60+
displayName: Merge subscription configurations

eng/common/TestResources/deploy-test-resources.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ parameters:
88
ServiceConnection: not-specified
99
ResourceType: test
1010
UseFederatedAuth: false
11-
SubscriptionConfigurationFilePath: ''
12-
1311

1412
# SubscriptionConfiguration will be splatted into the parameters of the test
1513
# resources script. It should be JSON in the form:
@@ -56,18 +54,9 @@ steps:
5654
ScriptType: InlineScript
5755
Inline: |
5856
eng/common/scripts/Import-AzModules.ps1
59-
60-
if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') {
61-
$subscriptionConfiguration = `
62-
Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' `
63-
| ConvertFrom-Json -AsHashtable;
64-
} else {
65-
# Multiline string termination ('@) needs to be at the beginning
66-
# of the line
67-
$subscriptionConfiguration = @'
68-
${{ parameters.SubscriptionConfiguration }}
57+
$subscriptionConfiguration = @'
58+
${{ parameters.SubscriptionConfiguration }}
6959
'@ | ConvertFrom-Json -AsHashtable;
70-
}
7160
7261
# The subscriptionConfiguration may have ArmTemplateParameters defined, so
7362
# pass those in via the ArmTemplateParameters flag, and handle any
@@ -86,7 +75,6 @@ steps:
8675
- ${{ else }}:
8776
- pwsh: |
8877
eng/common/scripts/Import-AzModules.ps1
89-
9078
$subscriptionConfiguration = @'
9179
${{ parameters.SubscriptionConfiguration }}
9280
'@ | ConvertFrom-Json -AsHashtable;

eng/common/TestResources/remove-test-resources.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ parameters:
88
ResourceType: test
99
EnvVars: {}
1010
UseFederatedAuth: false
11-
SubscriptionConfigurationFilePath: ''
1211

1312
# SubscriptionConfiguration will be splat into the parameters of the test
1413
# resources script. It should be JSON in the form:
@@ -39,20 +38,10 @@ steps:
3938
Inline: |
4039
eng/common/scripts/Import-AzModules.ps1
4140
42-
43-
if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') {
44-
$subscriptionConfiguration = `
45-
Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' `
46-
| ConvertFrom-Json -AsHashtable;
47-
} else {
48-
# Multiline string termination ("@) needs to be at the beginning
49-
# of the line
50-
$subscriptionConfiguration = @"
51-
${{ parameters.SubscriptionConfiguration }}
41+
$subscriptionConfiguration = @"
42+
${{ parameters.SubscriptionConfiguration }}
5243
"@ | ConvertFrom-Json -AsHashtable;
5344
54-
}
55-
5645
eng/common/TestResources/Remove-TestResources.ps1 `
5746
@subscriptionConfiguration `
5847
-ResourceType '${{ parameters.ResourceType }}' `

eng/common/TestResources/sub-config/AzurePublicMsft.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"SubscriptionId": "2cd617ea-1866-46b1-90e3-fffb087ebf9b",
33
"TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
44
"TestApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360",
5+
"TestApplicationSecret": "",
56
"TestApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f",
67
"ProvisionerApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360",
8+
"ProvisionerApplicationSecret": "",
79
"ProvisionerApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f",
810
"Environment": "AzureCloud",
911
"AzureSubscription": "Azure SDK Test Resources"

0 commit comments

Comments
 (0)