Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 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
11296ea
[auto]create by sdk generation
May 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
228 changes: 135 additions & 93 deletions doc/dev/mgmt/tests.md

Large diffs are not rendered by default.

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
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": "f699f9210bfb53e5841bd45c5637a122a17ad32b",
"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()
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,23 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from copy import deepcopy
from typing import Any, TYPE_CHECKING

from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient

from ._configuration import AzureAgriFoodRPServiceConfiguration
from .operations import ExtensionsOperations
from .operations import FarmBeatsExtensionsOperations
from .operations import FarmBeatsModelsOperations
from .operations import LocationsOperations
from .operations import Operations
from . import models
from ._configuration import AzureAgriFoodRPServiceConfiguration
from .operations import ExtensionsOperations, FarmBeatsExtensionsOperations, FarmBeatsModelsOperations, LocationsOperations, Operations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential

class AzureAgriFoodRPService(object):
class AzureAgriFoodRPService:
"""APIs documentation for Azure AgriFood Resource Provider Service.

:ivar extensions: ExtensionsOperations operations
Expand All @@ -44,55 +39,59 @@ class AzureAgriFoodRPService(object):
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
base_url=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = AzureAgriFoodRPServiceConfiguration(credential, subscription_id, **kwargs)
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureAgriFoodRPServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.farm_beats_extensions = FarmBeatsExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.farm_beats_models = FarmBeatsModelsOperations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)


self.extensions = ExtensionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.farm_beats_extensions = FarmBeatsExtensionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.farm_beats_models = FarmBeatsModelsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.

:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart

:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
:rtype: ~azure.core.rest.HttpResponse
"""
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
Expand Down
Loading