11
11
from packaging .version import Version
12
12
from ghapi .all import GhApi
13
13
from github import Github
14
- from azure .storage .blob import BlobServiceClient , ContainerClient
15
14
from datetime import datetime , timedelta
16
15
import importlib
17
16
@@ -110,8 +109,6 @@ def __init__(self):
110
109
self .bot_token = os .getenv ('BOT_TOKEN' )
111
110
self .spec_readme = os .getenv ('SPEC_README' , '' )
112
111
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 ('/' )
115
112
self .target_date = os .getenv ('TARGET_DATE' , '' )
116
113
self .test_folder = os .getenv ('TEST_FOLDER' , '' )
117
114
@@ -123,8 +120,6 @@ def __init__(self):
123
120
self .next_version = ''
124
121
self .test_result = ''
125
122
self .pr_number = 0
126
- self .container_name = ''
127
- self .private_package_link = [] # List[str]
128
123
self .tag_is_stable = False
129
124
self .has_test = False
130
125
self .check_package_size_result = [] # List[str]
@@ -519,17 +514,6 @@ def zero_version_policy(self):
519
514
issue_number = int (self .issue_link .split ('/' )[- 1 ])
520
515
api_request .issues .add_labels (issue_number = issue_number , labels = ['base-branch-attention' ])
521
516
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
-
533
517
@property
534
518
def after_multiapi_combiner (self ) -> bool :
535
519
content = self .get_autorest_result ()
@@ -543,31 +527,6 @@ def get_private_package(self) -> List[str]:
543
527
def get_whl_package (self ) -> str :
544
528
return [package for package in self .get_private_package () if package .endswith ('.whl' )][0 ]
545
529
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
-
571
530
def ask_check_policy (self ):
572
531
changelog = self .get_changelog ()
573
532
if changelog == '' :
@@ -578,15 +537,13 @@ def ask_check_policy(self):
578
537
issue_number = int (self .issue_link .split ('/' )[- 1 ])
579
538
api = GhApi (owner = 'Azure' , repo = 'sdk-release-request' , token = self .bot_token )
580
539
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 ' \
583
541
f'```\n ' \
584
542
f'CHANGELOG:\n ' \
585
543
f'{ changelog } \n ' \
586
544
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 '
590
547
api .issues .create_comment (issue_number = issue_number , body = body )
591
548
592
549
# comment for hint
0 commit comments