1111from packaging .version import Version
1212from ghapi .all import GhApi
1313from github import Github
14- from azure .storage .blob import BlobServiceClient , ContainerClient
1514from datetime import datetime , timedelta
1615import importlib
1716
@@ -110,8 +109,6 @@ def __init__(self):
110109 self .bot_token = os .getenv ('BOT_TOKEN' )
111110 self .spec_readme = os .getenv ('SPEC_README' , '' )
112111 self .spec_repo = os .getenv ('SPEC_REPO' , '' )
113- self .conn_str = os .getenv ('STORAGE_CONN_STR' )
114- self .storage_endpoint = os .getenv ('STORAGE_ENDPOINT' ).strip ('/' )
115112 self .target_date = os .getenv ('TARGET_DATE' , '' )
116113 self .test_folder = os .getenv ('TEST_FOLDER' , '' )
117114
@@ -123,8 +120,6 @@ def __init__(self):
123120 self .next_version = ''
124121 self .test_result = ''
125122 self .pr_number = 0
126- self .container_name = ''
127- self .private_package_link = [] # List[str]
128123 self .tag_is_stable = False
129124 self .has_test = False
130125 self .check_package_size_result = [] # List[str]
@@ -519,17 +514,6 @@ def zero_version_policy(self):
519514 issue_number = int (self .issue_link .split ('/' )[- 1 ])
520515 api_request .issues .add_labels (issue_number = issue_number , labels = ['base-branch-attention' ])
521516
522- def get_container_name (self ) -> str :
523- container_name = current_time_month ()
524- service_client = BlobServiceClient .from_connection_string (conn_str = self .conn_str )
525- containers_exist = [container for container in service_client .list_containers ()]
526- containers_name = {container .name for container in containers_exist }
527- # create new container if it does not exist
528- if container_name not in containers_name :
529- container_client = service_client .get_container_client (container = container_name )
530- container_client .create_container (public_access = 'container' , timeout = 60 * 24 * 3600 )
531- return container_name
532-
533517 @property
534518 def after_multiapi_combiner (self ) -> bool :
535519 content = self .get_autorest_result ()
@@ -543,31 +527,6 @@ def get_private_package(self) -> List[str]:
543527 def get_whl_package (self ) -> str :
544528 return [package for package in self .get_private_package () if package .endswith ('.whl' )][0 ]
545529
546- def upload_private_package_proc (self , container_name : str ):
547- container_client = ContainerClient .from_connection_string (conn_str = self .conn_str , container_name = container_name )
548- private_package = self .get_private_package ()
549- for package in private_package :
550- package_name = Path (package ).parts [- 1 ]
551- # package will be uploaded to storage account in the folder : container_name / pr_number / package_name
552- blob_name = f'sdk_pr_{ self .pr_number } /{ package_name } '
553- blob_client = container_client .get_blob_client (blob = blob_name )
554- with open (package , 'rb' ) as data :
555- blob_client .upload_blob (data , overwrite = True )
556- self .private_package_link .append (f'{ self .storage_endpoint } /{ container_name } /{ blob_name } ' )
557-
558- def upload_private_package (self ):
559- container_name = self .get_container_name ()
560- self .upload_private_package_proc (container_name )
561-
562- def get_private_package_link (self ) -> str :
563- self .upload_private_package ()
564- result = []
565- # it is for markdown
566- for link in self .private_package_link :
567- package_name = link .split ('/' )[- 1 ]
568- result .append (f'* [{ package_name } ]({ link } )\n ' )
569- return '' .join (result )
570-
571530 def ask_check_policy (self ):
572531 changelog = self .get_changelog ()
573532 if changelog == '' :
@@ -578,15 +537,13 @@ def ask_check_policy(self):
578537 issue_number = int (self .issue_link .split ('/' )[- 1 ])
579538 api = GhApi (owner = 'Azure' , repo = 'sdk-release-request' , token = self .bot_token )
580539 author = api .issues .get (issue_number = issue_number ).user .login
581- body = f'Hi @{ author } , Please check whether the package works well and the CHANGELOG info is as below:\n ' \
582- f'{ self .get_private_package_link ()} ' \
540+ body = f'Hi @{ author } , please check whether CHANGELOG for this release meet requirements:\n ' \
583541 f'```\n ' \
584542 f'CHANGELOG:\n ' \
585543 f'{ changelog } \n ' \
586544 f'```\n ' \
587- f'* (If you are not a Python User, you can mainly check whether the changelog meets your requirements)\n \n ' \
588- f'* (The version of the package is only a temporary version for testing)\n \n ' \
589- f'https://github.com/Azure/azure-sdk-for-python/pull/{ self .pr_number } '
545+ '* (If you want private package for test or development, ' \
546+ f'please build it locally with [guidance](https://github.com/Azure/azure-sdk-for-python/wiki/Common-issues-about-Python-SDK#build-private-package-with-pr) with https://github.com/Azure/azure-sdk-for-python/pull/{ self .pr_number } )\n \n '
590547 api .issues .create_comment (issue_number = issue_number , body = body )
591548
592549 # comment for hint
0 commit comments