Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5ebba6e
[DPG][pipeline] integration to swagger pipeline (#24355)
msyyc May 9, 2022
bc9bb07
Create communication samples (#24268)
lzchen May 9, 2022
41bd866
[SchemaRegistry] avro update docstring (#24364)
swathipil May 9, 2022
353743e
[AutoRelease] t2-redhatopenshift-2022-05-05-85576(Do not merge) (#24302)
azclibot May 10, 2022
091ed45
[ACR] Pull/push support for OCI manifest and blob (#24004)
May 10, 2022
4bf7e7e
[AutoRelease] t2-network-2022-04-28-56088(Do not merge) (#24228)
azclibot May 10, 2022
d5e45f0
Increment package version after release of azure-identity (#24371)
azure-sdk May 10, 2022
4a7eeb5
[KeyVault] Administration Test to Test Proxy (#24334)
kashifkhan May 10, 2022
3bc5ce6
Increment version for eventhub releases (#24376)
azure-sdk May 10, 2022
5497978
Package py.typed file (#24361)
lmazuel May 10, 2022
3b11ae1
[textanalytics] update documentation (#24318)
kristapratico May 11, 2022
604e78a
[Docs] update guidance for test (#23955)
BigCat20196 May 11, 2022
8808128
regen on official swagger / remove local swagger (#24382)
kristapratico May 11, 2022
3299dc7
Increment package version after release of azure-containerregistry (#…
azure-sdk May 11, 2022
6038f4e
Increment package version after release of azure-data-tables (#24389)
azure-sdk May 11, 2022
0d56155
[App] deprecate app package (#24393)
BigCat20196 May 11, 2022
f653416
add test (#24394)
Wzb123456789 May 11, 2022
45b43f1
[change_log] write a script for change_log (#23952)
kazrael2119 May 11, 2022
a80bbdd
Increment version for schemaregistry releases (#24375)
azure-sdk May 11, 2022
7b20eb6
[Cosmos] post-archboard fixes (#24358)
simorenoh May 11, 2022
343c219
[translation] doc fixes (#24381)
kristapratico May 11, 2022
e558aea
Increment version for storage releases (#24377)
azure-sdk May 11, 2022
348b56f
Update tox.ini (#24401)
tjprescott May 11, 2022
0d0ce45
add CertificateCredential sample (#24400)
xiangyan99 May 11, 2022
eae4f8b
Update readme for -pre and -post TestResource scripts (#24405)
azure-sdk May 11, 2022
86be3ae
[AutoRelease] t2-datafactory-2022-05-05-52029(Do not merge) (#24304)
azclibot May 12, 2022
319d7d6
create doc (#24419)
BigCat20196 May 12, 2022
db028c0
Update Azure monitor OpenTelemetry exporter example (#24422)
jenshnielsen May 12, 2022
5699616
String parsing improvements to service directory resource names (#24398)
azure-sdk May 12, 2022
54ef18d
Update semantic convention mappings (#24366)
lzchen May 12, 2022
ec1b7e4
[Cosmos] use python3 typehints and move options to kwargs on async cl…
simorenoh May 12, 2022
35e10b4
Update Azure Account ext. workaround guidance (#24429)
scottaddie May 12, 2022
c01e178
fix typing (#24424)
xiangyan99 May 12, 2022
b124280
code (#24253)
msyyc May 13, 2022
d698c15
code and test (#24432)
azclibot May 13, 2022
31cd127
[VideoAnalyzer] deprecate package (#24434)
BigCat20196 May 13, 2022
d7b01d7
[VideoAnalyzer] deprecate videoanalyzer (#24436)
BigCat20196 May 13, 2022
a6057b3
add option for key credential (#24437)
msyyc May 13, 2022
8c4b715
add option for key credential (#24437)
msyyc May 13, 2022
acd6945
[Cosmos] mark populate_query_metrics flag to be deleted when used and…
simorenoh May 13, 2022
1bd414e
[Cosmos] Fix failing unit tests (#24287)
simorenoh May 13, 2022
f938bb1
[Cosmos] deprecate offer naming in methods - merge available (#24428)
simorenoh May 13, 2022
ad5da24
add type hints to overload impl (#24406)
kristapratico May 13, 2022
a91ffc9
Create test_crud_async.py (#24166)
JericHunter May 13, 2022
8c7d2c8
[textanalytics] unskip tests and rerecord now that kebab-case bug is …
kristapratico May 13, 2022
2d50ef2
Add skip variable for remove test resources to support debugging (#24…
azure-sdk May 13, 2022
dbc4c07
fix test (#24445)
msyyc May 16, 2022
3ee35ea
code and test (#24457)
azclibot May 16, 2022
18cef1e
code and test (#24459)
azclibot May 16, 2022
5ebad49
[auto]create by sdk generation
May 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"livekvtestcertrec",
"livekvtestgetcertperfcert",
"livekvtestgetsecretperfsecret",
"livekvtestlistperfsecret",
"livekvtestlistperfsecret",
"livekvtestdecryptperfkey",
"livekvtestgetkeyperfkey",
"livekvtestsignperfkey",
Expand Down Expand Up @@ -242,6 +242,7 @@
"PSECRET",
"pygobject",
"parameterizing",
"pytyped",
"pytz",
"pywin",
"pyversion",
Expand Down
26 changes: 26 additions & 0 deletions doc/dev/how_to_request_a_feature_in_sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
How to Request a Feature in SDK
======

This article aims to provide a guide for customers to request a feature in Azure Python SDK.

Python SDK is automatically generated based on rest API, so we generally do not recommend modifying SDK code manually. If you need a new function, but the SDK does not provide it, you need to open an issue in the [rest API](https://github.com/Azure/azure-rest-api-specs/issues) to describe clearly the feature you want.

Then, if the feature is adopted by the service team and the relevant rest API is updated, we will regenerate the SDK and release it after approved.


The overall workflow is:
1. Swagger and service ready
2. Azure Python SDK release (PyPI)


```
--------- ------------
| | | |
| Service | -> | Python SDK |
| | | |
--------- ------------
```

This is the way that Azure Python SDK works with the Service team. Swagger PR should be merged before requesting azure Python SDK support.

Feel free to contact Azure CLI team at any time through any channels. We are passionate to build the world-class cloud product.
228 changes: 135 additions & 93 deletions doc/dev/mgmt/tests.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ try {
$BaseName = 't' + (New-Guid).ToString('n').Substring(0, 16)
Log "Generated base name '$BaseName' for CI build"
} else {
$BaseName = GetBaseName $UserName $ServiceDirectory
$BaseName = GetBaseName $UserName (GetServiceLeafDirectoryName $ServiceDirectory)
Log "BaseName was not set. Using default base name '$BaseName'"
}
}
Expand Down Expand Up @@ -520,7 +520,7 @@ try {
$ResourceGroupName
} elseif ($CI) {
# Format the resource group name based on resource group naming recommendations and limitations.
"rg-{0}-$BaseName" -f ($serviceName -replace '[\\\/:]', '-').Substring(0, [Math]::Min($serviceName.Length, 90 - $BaseName.Length - 4)).Trim('-')
"rg-{0}-$BaseName" -f ($serviceName -replace '[\.\\\/:]', '-').ToLowerInvariant().Substring(0, [Math]::Min($serviceName.Length, 90 - $BaseName.Length - 4)).Trim('-')
} else {
"rg-$BaseName"
}
Expand Down
43 changes: 43 additions & 0 deletions eng/common/TestResources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,49 @@ setx KEYVAULT_SKU ${env:KEYVAULT_SKU}
setx AZURE_KEYVAULT_URL ${env:AZURE_KEYVAULT_URL}
```

### Pre- and Post- Scripts

Sometimes creating test resources requires either some work to be done prior to or after the main test-resources.json script is executed.
For these scenarios a `test-resources-pre.ps1` or `test-resources-post.ps1`, respectively, can be created in the same folder as the `test-resources.json` file.

For example, it may be necessary to create artifacts prior to provisioning the actual resource, such as a certificate.
Typically the created artifact will need to be passed to `test-resources.json` to be used in the ARM template or as output (or both).

Below is an example of how `$templateFileParameters` can be used to pass data from the `pre-` script to `test-resources.json`.

**Snippet from `test-resources-pre.ps1`**
```powershell
$cert = New-X509Certificate2 -SubjectName '[email protected], CN=Azure SDK, OU=Azure SDK, O=Microsoft, L=Frisco, S=TX, C=US' -ValidDays 3652
# Create new entries in $templateFileParameters
$templateFileParameters['ConfidentialLedgerPrincipalPEM'] = Format-X509Certificate2 -Certificate $cert
$templateFileParameters['ConfidentialLedgerPrincipalPEMPK'] = Format-X509Certificate2 -Type Pkcs8 -Certificate $cert
```

**Snippet from the corresponding `test-resources.json`.**

Note that the values present in `$templateFileParameters` will map to parameters of the same name.
```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"_comment": "Other required parameters would go here... (this is not part of the actual test-resources.json)",
"ConfidentialLedgerPrincipalPEM": {
"type": "string",
"metadata": {
"description": "The certificate to configure as a certBasedSecurityPrincipal."
}
},
"ConfidentialLedgerPrincipalPEMPK": {
"type": "string",
"metadata": {
"description": "The certificate to configure as a certBasedSecurityPrincipal."
}
}
},
}
```

### Cleaning up Resources

By default, resource groups are tagged with a `DeleteAfter` value and date according to the default or specified
Expand Down
5 changes: 3 additions & 2 deletions eng/common/TestResources/SubConfig-Helpers.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function BuildServiceDirectoryPrefix([string]$serviceName) {
$serviceName = $serviceName -replace '[\./\\]', '_'
return $serviceName.ToUpperInvariant() + "_"
}

Expand All @@ -17,8 +18,8 @@ function GetUserName() {

function GetBaseName([string]$user, [string]$serviceDirectoryName) {
# Handle service directories in nested directories, e.g. `data/aztables`
$serviceDirectorySafeName = $serviceDirectoryName -replace '[/\\]', ''
return "$user$serviceDirectorySafeName"
$serviceDirectorySafeName = $serviceDirectoryName -replace '[\./\\]', ''
return "$user$serviceDirectorySafeName".ToLowerInvariant()
}

function ShouldMarkValueAsSecret([string]$serviceName, [string]$key, [string]$value, [array]$allowedValues = @())
Expand Down
2 changes: 1 addition & 1 deletion eng/common/TestResources/remove-test-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ steps:
-Force `
-Verbose
displayName: Remove test resources
condition: eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true')
condition: and(eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'), ne(variables['Skip.RemoveTestResources'], 'true'))
continueOnError: true
2 changes: 1 addition & 1 deletion eng/tox/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ deps =
{[base]deps}
commands =
# install API stub generator
{envbindir}/python -m pip install api-stub-generator --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
{envbindir}/python -m pip install api-stub-generator==0.2.11 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
{envbindir}/python -m pip freeze
{envbindir}/python {toxinidir}/../../../eng/tox/run_apistubgen.py -t {toxinidir} -w {envtmpdir} {posargs}

Expand Down
25 changes: 25 additions & 0 deletions scripts/check_change_log/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Overview
This script will generate change_log by comparing latest two versions of mgmt package on pypi. It can help us quickly verify whether the changes to the `change_log` tool are correct



# preprequisites
- [Python 3.6](https://www.python.org/downloads/windows/) or later is required
- [docker desktop](https://www.docker.com/get-started/)

# How to use this script
1.Use gitbash to create a new branch to work in.

2.Please make sure your docker is running on your computer.

3.Open your powershell and step in path where the script is in

4.Install the dependency
```bash
pip install -r requirements.txt
```

5.Run command in your powershell:
```
python main.py
```
121 changes: 121 additions & 0 deletions scripts/check_change_log/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# coding=utf-8
import glob
import os
import subprocess as sp
import time
from pypi_tools.pypi import PyPIClient
from pathlib import Path

error_packages_info = {}


def find_report_name(result):
signal_api_pattern = 'written to'
multi_api_pattern = 'merged_report'
for line in result:
idx = line.find(signal_api_pattern)
idx1 = line.find(multi_api_pattern)
if idx > 0 and idx1 > 0:
return "_/" + line[idx + len(signal_api_pattern):].replace(" ", "")

for line in result:
idx = line.find(signal_api_pattern)
if idx > 0:
return "_/" + line[idx + len(signal_api_pattern):].replace(" ", "")

return ''


def create_folder(name):
if not os.path.exists(name):
os.mkdir(name)


def write_txt(folder, text_name, content, older_version, last_version):
file_path = str(Path(f"{folder}/{text_name}_{older_version}_{last_version}.txt"))
with open(file=file_path, mode="w", encoding="utf-8") as file:
file.write(content)
print(f"{text_name} has been created successfully")


def create_code_report(cmd, service_name):
process = sp.Popen(
cmd,
stderr=sp.STDOUT,
stdout=sp.PIPE,
universal_newlines=True,
cwd=None,
shell=False,
env=None,
encoding="utf-8",
)
output_buffer = [line.rstrip() for line in process.stdout]
process.wait()
if process.returncode:
error_packages_info[service_name] = '\n'.join(output_buffer[-min(len(output_buffer), 10):])
raise Exception(f'fail to create code report of {service_name}')
return output_buffer


if __name__ == '__main__':
# get sdk path
env = Path.cwd()
docker_path = env.parent.parent
docker_cmd = 'docker exec -it Change_log /bin/bash -c'

# create docker env in sdk path
sp.call(fr"docker create -it --rm -h Change_log --name Change_log -v {docker_path}:/_ l601306339/autorest")
sp.call("docker start Change_log")

# install azure tools
sp.call(f'{docker_cmd} "python _/scripts/dev_setup.py -p azure-core" ')

# get all azure-mgmt-package paths
in_files = glob.glob(str(Path(f'{docker_path}/sdk/*/azure-mgmt-*')))
for i in in_files:
path = Path(i)
service_name = path.parts[-1]

# get package version in pypi
client = PyPIClient()
versions = [str(v) for v in client.get_ordered_versions(service_name)]
if len(versions) >= 2:
older_version = versions[-2]
last_version = versions[-1]

# generate code_report
cmd_last_version = fr'{docker_cmd} "cd _/ && python -m packaging_tools.code_report {service_name} --version={last_version}"'
cmd_older_version = fr'{docker_cmd} "cd _/ && python -m packaging_tools.code_report {service_name} --version={older_version}"'
try:
last_code_report_info = create_code_report(cmd_last_version, service_name)
older_code_report_info = create_code_report(cmd_older_version, service_name)

# get code_report path
route_last_version = find_report_name(last_code_report_info)
route_older_version = find_report_name(older_code_report_info)

# use change_log on these two code_reports
result = sp.check_output(
f'{docker_cmd} "python -m packaging_tools.change_log {route_older_version} {route_last_version}"',
shell=True, universal_newlines=True)
except sp.CalledProcessError as e:
print(f'error happened for {service_name} during changelog generation')
error_packages_info[service_name] = str(e)
except Exception as e:
print(f'error happened for {service_name} during code report generation: {e}')
else:
output_message = result.split("\n")
result_text = "\n".join(output_message[1:])

# write a txt to save change_log
change_log_folder_path = str(env / "Change_Log")
create_folder(change_log_folder_path)
write_txt(change_log_folder_path, service_name, result_text, older_version, last_version)

if error_packages_info:
for k, v in error_packages_info.items():
print(f'== {k} encountered an error, info: {v}')

# exit and stop docker
sp.call(f'{docker_cmd} "exit"')
sp.call(f'docker stop Change_log')
1 change: 1 addition & 0 deletions scripts/check_change_log/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e ../../tools/azure-sdk-tools
2 changes: 1 addition & 1 deletion scripts/quickstart_tooling_dpg/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jinja2
jinja2==3.1.2
18 changes: 15 additions & 3 deletions scripts/quickstart_tooling_dpg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from jinja2 import Environment, FileSystemLoader
from subprocess import check_call
import time
from typing import Any
from typing import Any, Dict

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -106,6 +106,11 @@ def build_package(**kwargs) -> None:
_LOGGER.info("Build complete: %s", package_name)


def validate_params(**kwargs):
if not kwargs.get("security_scope") and not kwargs.get("security_header_name"):
raise Exception('At least one of "security-scope" and "security-header-name" is needed')


def main(**kwargs):
build_package(**kwargs)

Expand All @@ -132,8 +137,14 @@ def main(**kwargs):
parser.add_argument(
"--security-scope", "-c",
dest="security_scope",
required=True,
help="Each service for data plan should have specific scopes",
required=False,
help="If authentication is AADToken, this param is necessary",
)
parser.add_argument(
"--security-header-name",
dest="security_header_name",
required=False,
help="If authentication is api key, this param is necessary",
)
parser.add_argument(
"--package-name", "-p",
Expand All @@ -160,4 +171,5 @@ def main(**kwargs):
main_logger.setLevel(logging.INFO)

parameters = vars(args)
validate_params(**parameters)
main(**parameters)
5 changes: 5 additions & 0 deletions scripts/quickstart_tooling_dpg/template/swagger_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ no-namespace-folders: true
title: {{ client_name }}
version-tolerant: true
package-version: 1.0.0b1
{%- if security_scope %}
security: AADToken
security-scopes: {{ security_scope }}
{%- elif security_header_name %}
security: AzureKey
security-header-name: {{ security_header_name }}
{%- endif %}
```
12 changes: 6 additions & 6 deletions sdk/agrifood/azure-mgmt-agrifood/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.4.2",
"autorest": "3.7.2",
"use": [
"@autorest/python@5.8.0",
"@autorest/[email protected].2"
"@autorest/python@5.13.0",
"@autorest/[email protected].3"
],
"commit": "5ee4aa771330a0120416c066386e6d86693978b4",
"commit": "a5ddbe85d3985a1be45128eb1ef77c43c7238151",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/agfood/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/[email protected].2 --version=3.4.2",
"readme": "specification/agfood/resource-manager/readme.md"
"autorest_command": "autorest agrifood/resource-manager/readme.md --multiapi --python --python-sdks-folder=/sdk-repo/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/[email protected].3 --version=3.7.2",
"readme": "agrifood/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
__version__ = VERSION
__all__ = ['AzureAgriFoodRPService']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
Loading