Date: Fri, 10 Jun 2022 13:35:04 +0800
Subject: [PATCH 053/103] auto-close
---
scripts/release_helper/common.py | 1 +
scripts/release_helper/python.py | 20 ++++++++++++++++++--
scripts/release_helper/utils.py | 24 ++++++++++++++++++++++--
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 38a516dc70b6..472d7bec1fdb 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -51,6 +51,7 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.request_repo_dict = request_repo_dict
self.assignee = issue_package.issue.assignee.login if issue_package.issue.assignee else ''
self.owner = issue_package.issue.user.login
+ self.created_time = issue_package.issue.created_at
self.assignee_candidates = assignee_candidates
self.language_owner = language_owner
self.bot_advice = []
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 3a5e48a00c7d..d94c4a0c6b84 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -1,8 +1,9 @@
+import os
import re
+from typing import Any, List
from common import IssueProcess, Common
-from typing import Any, List
-import os
+from utils import AUTO_CLOSE_LABEL, get_last_released_date
# assignee dict which will be assigned to handle issues
_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'azure-sdk'}
@@ -28,6 +29,21 @@ def get_edit_content(self) -> None:
self.get_package_name()
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
+ def auto_close(self) -> None:
+ if AUTO_CLOSE_LABEL in self.issue_package.labels_name:
+ return
+ last_version, last_time = get_last_released_date(self.package_name)
+ if last_time and last_time > self.created_time:
+ comment = f'Hi @{self.owner}, pypi link: https://pypi.org/project/{self.package_name}/{last_version}/'
+ self.issue_package.issue.create_comment(body=comment)
+ self.issue_package.issue.edit(state='closed')
+ self.issue_package.issue.add_to_labels('auto-closed')
+ self.log("has been closed!")
+
+ def run(self) -> None:
+ super().run()
+ self.auto_close()
+
class Python(Common):
def __init__(self, issues, assignee_token, language_owner):
super(Python, self).__init__(issues, assignee_token, language_owner)
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index 611a6e8e989c..67220ea89eab 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -1,12 +1,17 @@
-from github.Issue import Issue
-from github.Repository import Repository
+import datetime
import logging
from typing import List
+from bs4 import BeautifulSoup
+from github.Issue import Issue
+from github.Repository import Repository
+import requests
+
REQUEST_REPO = 'Azure/sdk-release-request'
REST_REPO = 'Azure/azure-rest-api-specs'
AUTO_ASSIGN_LABEL = 'assigned'
AUTO_PARSE_LABEL = 'auto-link'
+AUTO_CLOSE_LABEL = 'auto-close'
MULTI_LINK_LABEL = 'MultiLink'
_LOG = logging.getLogger(__name__)
@@ -27,6 +32,20 @@ def get_origin_link_and_tag(issue_body_list: List[str]) -> (str, str):
link = link.replace('[', "").replace(']', "").replace('(', "").replace(')', "")
return link, readme_tag
+def get_last_released_date(package_name):
+ pypi_link = f'https://pypi.org/project/{package_name}/#history'
+ res = requests.get(pypi_link)
+ soup = BeautifulSoup(res.text, 'html.parser')
+ # find top div from
+ try:
+ package_info = soup.select('div[class="release-timeline"]')[0].find_all('div')[0]
+ last_version_mix = package_info.find_all('p', class_="release__version")[0].contents[0]
+ except IndexError as e:
+ return '', ''
+ last_version = last_version_mix.replace(' ', '').replace('\n', '')
+ last_version_date_str = package_info.time.attrs['datetime'].split('+')[0]
+ last_version_date = datetime.datetime.strptime(last_version_date_str, '%Y-%m-%dT%H:%M:%S')
+ return last_version, last_version_date
class IssuePackage:
issue = None # origin issue instance
@@ -35,5 +54,6 @@ class IssuePackage:
def __init__(self, issue: Issue, rest_repo: Repository):
self.issue = issue
+ self.issue_num =
self.rest_repo = rest_repo
self.labels_name = {label.name for label in issue.labels}
From 98acf92cc42cc0891a98b327db52ce8e9cdd0ced Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 14:22:16 +0800
Subject: [PATCH 054/103] record release
---
scripts/release_helper/python.py | 7 ++++++-
scripts/release_helper/utils.py | 20 +++++++++++++++++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index d94c4a0c6b84..16a5dd281677 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -3,7 +3,7 @@
from typing import Any, List
from common import IssueProcess, Common
-from utils import AUTO_CLOSE_LABEL, get_last_released_date
+from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release
# assignee dict which will be assigned to handle issues
_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'azure-sdk'}
@@ -14,6 +14,9 @@
'msyyc': os.getenv('PYTHON_MSYYC_TOKEN'),
}
+# record published issues
+_FILE_OUT = 'published_issues_python.csv'
+
class IssueProcessPython(IssueProcess):
@@ -39,10 +42,12 @@ def auto_close(self) -> None:
self.issue_package.issue.edit(state='closed')
self.issue_package.issue.add_to_labels('auto-closed')
self.log("has been closed!")
+ record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
def run(self) -> None:
super().run()
self.auto_close()
+
class Python(Common):
def __init__(self, issues, assignee_token, language_owner):
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index 67220ea89eab..17ce9bc7285e 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -1,6 +1,6 @@
import datetime
import logging
-from typing import List
+from typing import List, Any
from bs4 import BeautifulSoup
from github.Issue import Issue
@@ -32,7 +32,8 @@ def get_origin_link_and_tag(issue_body_list: List[str]) -> (str, str):
link = link.replace('[', "").replace(']', "").replace('(', "").replace(')', "")
return link, readme_tag
-def get_last_released_date(package_name):
+
+def get_last_released_date(package_name: str) -> (str, str):
pypi_link = f'https://pypi.org/project/{package_name}/#history'
res = requests.get(pypi_link)
soup = BeautifulSoup(res.text, 'html.parser')
@@ -47,6 +48,20 @@ def get_last_released_date(package_name):
last_version_date = datetime.datetime.strptime(last_version_date_str, '%Y-%m-%dT%H:%M:%S')
return last_version, last_version_date
+
+def record_release(package_name: str, issue_info: Any, file: str) -> None:
+ created_at = issue_info.created_at.strftime('%Y-%m-%d')
+ closed_at = issue_info.closed_at.strftime('%Y-%m-%d')
+ assignee = issue_info.assignee.login
+ link = issue_info.html_url
+ closed_issue_info = f'{package_name},{assignee},{created_at},{closed_at},{link}\n'
+ with open(file, 'r') as file_read:
+ lines = file_read.readlines()
+ with open(file, 'w') as file_write:
+ lines.insert(1, closed_issue_info)
+ file_write.writelines(lines)
+
+
class IssuePackage:
issue = None # origin issue instance
rest_repo = None # repo instance: Azure/azure-rest-api-specs
@@ -54,6 +69,5 @@ class IssuePackage:
def __init__(self, issue: Issue, rest_repo: Repository):
self.issue = issue
- self.issue_num =
self.rest_repo = rest_repo
self.labels_name = {label.name for label in issue.labels}
From 59a156b68622efb563fa45e7a08e62fa266f61f7 Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 14:37:02 +0800
Subject: [PATCH 055/103] debug
---
scripts/release_helper/common.py | 1 +
scripts/release_helper/python.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 472d7bec1fdb..abb817cf0328 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -314,6 +314,7 @@ def output(self):
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
for item in self.result:
+ print(f'**** item: {item}')
try:
item_status = Common.output_md(item)
file_out.write(item_status)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 16a5dd281677..7d8871d1dcc0 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -47,7 +47,7 @@ def auto_close(self) -> None:
def run(self) -> None:
super().run()
self.auto_close()
-
+
class Python(Common):
def __init__(self, issues, assignee_token, language_owner):
From d7f4fcae5e59f7ccff2c76db0764a6219e352661 Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 14:43:33 +0800
Subject: [PATCH 056/103] debug
---
scripts/release_helper/common.py | 2 +-
scripts/release_helper/python.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index abb817cf0328..fb8a40b1f450 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -314,7 +314,7 @@ def output(self):
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
for item in self.result:
- print(f'**** item: {item}')
+ print(f'**** item: {dict(item)}')
try:
item_status = Common.output_md(item)
file_out.write(item_status)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 7d8871d1dcc0..c49cd7f4669d 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -29,7 +29,6 @@ def get_package_name(self) -> None:
print(f'*** package_name: {self.package_name}')
def get_edit_content(self) -> None:
- self.get_package_name()
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
def auto_close(self) -> None:
@@ -45,6 +44,7 @@ def auto_close(self) -> None:
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
def run(self) -> None:
+ self.get_package_name()
super().run()
self.auto_close()
From c338d581ca090de71a080f6141cc2070bc23397d Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 14:49:35 +0800
Subject: [PATCH 057/103] debug
---
scripts/release_helper/common.py | 2 +-
scripts/release_helper/python.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index fb8a40b1f450..abb817cf0328 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -314,7 +314,7 @@ def output(self):
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
for item in self.result:
- print(f'**** item: {dict(item)}')
+ print(f'**** item: {item}')
try:
item_status = Common.output_md(item)
file_out.write(item_status)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index c49cd7f4669d..5dbd79ff44cd 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -48,6 +48,9 @@ def run(self) -> None:
super().run()
self.auto_close()
+ def __repr__(self):
+ return self.issue_package.issue.number, self.package_name
+
class Python(Common):
def __init__(self, issues, assignee_token, language_owner):
From 7d04c42208a866726a70f98514a2ecba137bffd9 Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 16:10:15 +0800
Subject: [PATCH 058/103] override run
---
scripts/release_helper/python.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 5dbd79ff44cd..7310f19da85b 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -44,8 +44,12 @@ def auto_close(self) -> None:
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
def run(self) -> None:
+ # common part(don't change the order)
+ self.auto_assign() # necessary flow
+ self.auto_parse() # necessary flow
self.get_package_name()
- super().run()
+ self.get_target_date()
+ self.auto_bot_advice() # make sure this is the last step
self.auto_close()
def __repr__(self):
From 195d661575f674c3fada288021288691753b734b Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 16:29:04 +0800
Subject: [PATCH 059/103] init readme link
---
scripts/release_helper/common.py | 1 +
scripts/release_helper/python.py | 18 ++++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index abb817cf0328..3c699dca900f 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -278,6 +278,7 @@ def get_target_date(self):
def run(self) -> None:
# common part(don't change the order)
self.auto_assign() # necessary flow
+ self.init_readme_link()
self.auto_parse() # necessary flow
self.get_target_date()
self.auto_bot_advice() # make sure this is the last step
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 7310f19da85b..c2b2ff0ba94a 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -2,7 +2,7 @@
import re
from typing import Any, List
-from common import IssueProcess, Common
+from common import IssueProcess, Common, get_origin_link_and_tag
from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release
# assignee dict which will be assigned to handle issues
@@ -20,7 +20,17 @@
class IssueProcessPython(IssueProcess):
+ def init_readme_link(self) -> None:
+ issue_body_list = self.get_issue_body()
+
+ # Get the origin link and readme tag in issue body
+ origin_link, self.target_readme_tag = get_origin_link_and_tag(issue_body_list)
+
+ # get readme_link
+ self.get_readme_link(origin_link)
+
def get_package_name(self) -> None:
+ self.init_readme_link()
pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager')
readme_python_path = pattern_resource_manager.search(self.readme_link).group() + '/readme.python.md'
contents = str(self.issue_package.rest_repo.get_contents(readme_python_path).decoded_content)
@@ -44,12 +54,8 @@ def auto_close(self) -> None:
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
def run(self) -> None:
- # common part(don't change the order)
- self.auto_assign() # necessary flow
- self.auto_parse() # necessary flow
self.get_package_name()
- self.get_target_date()
- self.auto_bot_advice() # make sure this is the last step
+ super().run()
self.auto_close()
def __repr__(self):
From b182787df7b1ef61899ca80769d172f3bac5bc93 Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 16:43:19 +0800
Subject: [PATCH 060/103] fix
---
scripts/release_helper/common.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 3c699dca900f..abb817cf0328 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -278,7 +278,6 @@ def get_target_date(self):
def run(self) -> None:
# common part(don't change the order)
self.auto_assign() # necessary flow
- self.init_readme_link()
self.auto_parse() # necessary flow
self.get_target_date()
self.auto_bot_advice() # make sure this is the last step
From 059636375c191078adcac1f146ab657363efc74a Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 16:49:32 +0800
Subject: [PATCH 061/103] fix
---
scripts/release_helper/common.py | 2 +-
scripts/release_helper/python.py | 4 ----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index abb817cf0328..fb6c4e63e157 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -314,7 +314,7 @@ def output(self):
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
for item in self.result:
- print(f'**** item: {item}')
+ print(f'**** item: {item.issue}')
try:
item_status = Common.output_md(item)
file_out.write(item_status)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index c2b2ff0ba94a..fa27564aac76 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -58,10 +58,6 @@ def run(self) -> None:
super().run()
self.auto_close()
- def __repr__(self):
- return self.issue_package.issue.number, self.package_name
-
-
class Python(Common):
def __init__(self, issues, assignee_token, language_owner):
super(Python, self).__init__(issues, assignee_token, language_owner)
From 7b11ace7920be500c60c36b3bc79c6e0841156d8 Mon Sep 17 00:00:00 2001
From: "Jiefeng Chen (WICRESOFT NORTH AMERICA LTD)"
Date: Mon, 13 Jun 2022 16:54:22 +0800
Subject: [PATCH 062/103] fix
---
scripts/release_helper/common.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index fb6c4e63e157..480ddcdd7128 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -314,7 +314,7 @@ def output(self):
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
for item in self.result:
- print(f'**** item: {item.issue}')
+ print(f'**** item: {item.issue_package.issue.number}')
try:
item_status = Common.output_md(item)
file_out.write(item_status)
From 373c12b81308a0039b0ce1dc96e24bee1d241aec Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Mon, 20 Jun 2022 17:16:22 +0800
Subject: [PATCH 063/103] update assignee_token and auto-close
---
scripts/release_helper/common.py | 21 ++++++++++++---------
scripts/release_helper/go.py | 11 ++++-------
scripts/release_helper/java.py | 15 ++++-----------
scripts/release_helper/js.py | 11 ++++-------
scripts/release_helper/python.py | 9 +++------
5 files changed, 27 insertions(+), 40 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 480ddcdd7128..82e3edf5fa11 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -19,7 +19,8 @@
_LANGUAGE_OWNER = {'msyyc'}
# 'github assignee': 'token'
-_ASSIGNEE_TOKEN = {'msyyc': os.getenv('AZURESDK_BOT_TOKEN')}
+_BOT_NAME = 'azure-sdk'
+_ASSIGNEE_TOKEN = os.getenv('AZURESDK_BOT_TOKEN')
_SWAGGER_URL = 'https://github.com/Azure/azure-rest-api-specs/blob/main/specification'
_SWAGGER_PULL = 'https://github.com/Azure/azure-rest-api-specs/pull'
@@ -62,6 +63,7 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.package_name = ''
self.target_date = ''
self.date_from_target = 0
+ self.is_open = True
def get_issue_body(self) -> List[str]:
return [i for i in self.issue_package.issue.body.split("\n") if i]
@@ -293,10 +295,11 @@ class Common:
file_out_name = '' # file that storages issue status
"""
- def __init__(self, issues_package: List[IssuePackage], assignee_token: Dict[str, str], language_owner: Set[str]):
+ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str], assignee_token=_ASSIGNEE_TOKEN):
self.issues_package = issues_package
- self.assignee_candidates = set(assignee_token.keys())
self.language_owner = language_owner
+ language_owner.discard(_BOT_NAME)
+ self.assignee_candidates = language_owner
# arguments add to language.md
self.file_out_name = 'common.md'
self.target_release_date = ''
@@ -306,18 +309,18 @@ def __init__(self, issues_package: List[IssuePackage], assignee_token: Dict[str,
self.request_repo_dict = {}
self.issue_process_function = IssueProcess
- for assignee in assignee_token:
- self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
+ for assignee in self.assignee_candidates:
+ self.request_repo_dict[assignee] = Github(assignee_token).get_repo(REQUEST_REPO)
def output(self):
with open(self.file_out_name, 'w') as file_out:
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
for item in self.result:
- print(f'**** item: {item.issue_package.issue.number}')
try:
- item_status = Common.output_md(item)
- file_out.write(item_status)
+ if item.is_open:
+ item_status = Common.output_md(item)
+ file_out.write(item_status)
except Exception as e:
_LOG.error(f'Error happened during output result of handled issue {item.issue_package.issue.number}: {e}')
@@ -354,5 +357,5 @@ def run(self):
def common_process(issues: List[IssuePackage]):
- instance = Common(issues, _ASSIGNEE_TOKEN, _LANGUAGE_OWNER)
+ instance = Common(issues, _ASSIGNEE_TOKEN, _LANGUAGE_OWNER)
instance.run()
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index eca89c5cd5c3..bbb013b4f230 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -3,10 +3,7 @@
import os
# assignee dict which will be assigned to handle issues
-_GO_OWNER = {'ArcturusZhang', 'Alancere'}
-
-# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_GO = {'Alancere': os.getenv('AZURESDK_BOT_TOKEN')}
+_GO_OWNER = {'ArcturusZhang', 'Alancere', 'azure-sdk'}
class IssueProcessGo(IssueProcess):
@@ -14,11 +11,11 @@ class IssueProcessGo(IssueProcess):
class Go(Common):
- def __init__(self, issues, assignee_token, language_owner):
- super(Go, self).__init__(issues, assignee_token, language_owner)
+ def __init__(self, issues, language_owner):
+ super(Go, self).__init__(issues, language_owner)
self.file_out_name = 'release_go_status.md'
def go_process(issues: List[Any]):
- instance = Go(issues, _ASSIGNEE_TOKEN_GO, _GO_OWNER)
+ instance = Go(issues, _GO_OWNER)
instance.run()
diff --git a/scripts/release_helper/java.py b/scripts/release_helper/java.py
index 65b84f38c601..121620a2fcf4 100644
--- a/scripts/release_helper/java.py
+++ b/scripts/release_helper/java.py
@@ -4,26 +4,19 @@
import os
# assignee dict which will be assigned to handle issues
-_JAVA_OWNER = {'weidongxu-microsoft', 'haolingdong-msft', 'XiaofeiCao'}
-
-# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_JAVA = {
- 'weidongxu-microsoft': os.getenv('AZURESDK_BOT_TOKEN'),
- 'haolingdong-msft': os.getenv('AZURESDK_BOT_TOKEN'),
- 'XiaofeiCao': os.getenv('AZURESDK_BOT_TOKEN'),
-}
+_JAVA_OWNER = {'weidongxu-microsoft', 'haolingdong-msft', 'XiaofeiCao', 'azure-sdk'}
class IssueProcessJava(IssueProcess):
pass
class Java(Common):
- def __init__(self, issues, assignee_token, language_owner):
- super(Java, self).__init__(issues, assignee_token, language_owner)
+ def __init__(self, issues, language_owner):
+ super(Java, self).__init__(issues, language_owner)
self.file_out_name = 'release_java_status.md'
def java_process(issues: List[Any]):
- instance = Java(issues, _ASSIGNEE_TOKEN_JAVA, _JAVA_OWNER)
+ instance = Java(issues, _JAVA_OWNER)
instance.run()
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index 12495205d993..7bcdcdcf460a 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -4,10 +4,7 @@
import os
# assignee dict which will be assigned to handle issues
-_JS_OWNER = {'qiaozha', 'lirenhe', 'MaryGao'}
-
-# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_JS = {'qiaozha': os.getenv('AZURESDK_BOT_TOKEN'), 'MaryGao': os.getenv('AZURESDK_BOT_TOKEN')}
+_JS_OWNER = {'qiaozha', 'lirenhe', 'MaryGao', 'azure-sdk'}
class IssueProcessJs(IssueProcess):
@@ -20,11 +17,11 @@ def auto_assign_policy(self) -> str:
class Js(Common):
- def __init__(self, issues, assignee_token, language_owner):
- super(Js, self).__init__(issues, assignee_token, language_owner)
+ def __init__(self, issues, language_owner):
+ super(Js, self).__init__(issues, language_owner)
self.file_out_name = 'release_js_status.md'
self.issue_process_function = IssueProcessJs
def js_process(issues: List[Any]):
- instance = Js(issues, _ASSIGNEE_TOKEN_JS, _JS_OWNER)
+ instance = Js(issues, _JS_OWNER)
instance.run()
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index fa27564aac76..1443c785a177 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -9,10 +9,7 @@
_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'azure-sdk'}
# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_PYTHON = {
- 'BigCat20196': os.getenv('PYTHON_BIGCAT_TOKEN'),
- 'msyyc': os.getenv('PYTHON_MSYYC_TOKEN'),
-}
+_ASSIGNEE_TOKEN_PYTHON = os.getenv('AZURESDK_BOT_TOKEN')
# record published issues
_FILE_OUT = 'published_issues_python.csv'
@@ -36,7 +33,6 @@ def get_package_name(self) -> None:
contents = str(self.issue_package.rest_repo.get_contents(readme_python_path).decoded_content)
pattern_package = re.compile(r'package-name: [\w+-.]+')
self.package_name = pattern_package.search(contents).group().split(':')[-1].strip()
- print(f'*** package_name: {self.package_name}')
def get_edit_content(self) -> None:
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
@@ -50,7 +46,8 @@ def auto_close(self) -> None:
self.issue_package.issue.create_comment(body=comment)
self.issue_package.issue.edit(state='closed')
self.issue_package.issue.add_to_labels('auto-closed')
- self.log("has been closed!")
+ self.is_open = False
+ self.log(f"{self.issue_package.issue.number} has been closed!")
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
def run(self) -> None:
From 7a32e05262e449c12061486d167d6bd0aa7ce6ef Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Mon, 20 Jun 2022 17:35:25 +0800
Subject: [PATCH 064/103] fix
---
scripts/release_helper/common.py | 2 +-
scripts/release_helper/python.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 82e3edf5fa11..e28e402d8396 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -357,5 +357,5 @@ def run(self):
def common_process(issues: List[IssuePackage]):
- instance = Common(issues, _ASSIGNEE_TOKEN, _LANGUAGE_OWNER)
+ instance = Common(issues, _LANGUAGE_OWNER)
instance.run()
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 1443c785a177..131c337a2485 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -8,8 +8,6 @@
# assignee dict which will be assigned to handle issues
_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'azure-sdk'}
-# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_PYTHON = os.getenv('AZURESDK_BOT_TOKEN')
# record published issues
_FILE_OUT = 'published_issues_python.csv'
@@ -56,12 +54,12 @@ def run(self) -> None:
self.auto_close()
class Python(Common):
- def __init__(self, issues, assignee_token, language_owner):
- super(Python, self).__init__(issues, assignee_token, language_owner)
+ def __init__(self, issues, language_owner):
+ super(Python, self).__init__(issues, language_owner)
self.file_out_name = 'release_python_status.md'
self.issue_process_function = IssueProcessPython
def python_process(issues: List[Any]):
- instance = Python(issues, _ASSIGNEE_TOKEN_PYTHON, _PYTHON_OWNER)
+ instance = Python(issues, _PYTHON_OWNER)
instance.run()
From 4cacd5fc60e1f392cd6a89aa59bb6bd399b41afc Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 21 Jun 2022 11:14:56 +0800
Subject: [PATCH 065/103] debug
---
scripts/release_helper/common.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index e28e402d8396..c194012a36b7 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -64,6 +64,7 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.target_date = ''
self.date_from_target = 0
self.is_open = True
+ print(f'**** issue {self.issue_package.issue.number}, language owner: {self.language_owner}, assignee_candidates: {self.assignee_candidates}')
def get_issue_body(self) -> List[str]:
return [i for i in self.issue_package.issue.body.split("\n") if i]
From 081e2ad58635b8da37cdb3ff05cf03020db80d57 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 21 Jun 2022 13:24:16 +0800
Subject: [PATCH 066/103] fix
---
scripts/release_helper/common.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index c194012a36b7..37e6fbfaec37 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -64,7 +64,6 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.target_date = ''
self.date_from_target = 0
self.is_open = True
- print(f'**** issue {self.issue_package.issue.number}, language owner: {self.language_owner}, assignee_candidates: {self.assignee_candidates}')
def get_issue_body(self) -> List[str]:
return [i for i in self.issue_package.issue.body.split("\n") if i]
@@ -298,7 +297,7 @@ class Common:
def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str], assignee_token=_ASSIGNEE_TOKEN):
self.issues_package = issues_package
- self.language_owner = language_owner
+ self.language_owner = language_owner.copy()
language_owner.discard(_BOT_NAME)
self.assignee_candidates = language_owner
# arguments add to language.md
From b07eb2eb9e2381bb783a58614aab406d73062253 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 21 Jun 2022 16:43:19 +0800
Subject: [PATCH 067/103] auto-reply
---
scripts/release_helper/python.py | 70 +++++++++++++++++++++++++++-----
scripts/release_helper/utils.py | 66 ++++++++++++++++++++++++++++++
2 files changed, 125 insertions(+), 11 deletions(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 131c337a2485..cbd11a3c010c 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -1,20 +1,29 @@
-import os
import re
-from typing import Any, List
+from typing import Any, List, Dict, Set
-from common import IssueProcess, Common, get_origin_link_and_tag
-from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release
-
-# assignee dict which will be assigned to handle issues
-_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'azure-sdk'}
+from github.Repository import Repository
+from common import IssueProcess, Common, get_origin_link_and_tag, IssuePackage
+from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release, get_python_release_pipeline, run_pipeline
+# assignee dict which will be assigned to handle issues
+_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'Wzb123456789', 'azure-sdk'}
+# labels
+_CONFIGURED = 'Configured'
+_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
# record published issues
_FILE_OUT = 'published_issues_python.csv'
class IssueProcessPython(IssueProcess):
+ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Repository],
+ assignee_candidates: Set[str], language_owner: Set[str]):
+ IssueProcess.__init__(issue_package, request_repo_dict, assignee_candidates, language_owner)
+ self.output_folder = ''
+ self.is_multiapi = False
+ self.pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager')
+
def init_readme_link(self) -> None:
issue_body_list = self.get_issue_body()
@@ -24,17 +33,54 @@ def init_readme_link(self) -> None:
# get readme_link
self.get_readme_link(origin_link)
- def get_package_name(self) -> None:
+ def get_package_and_output(self) -> None:
self.init_readme_link()
- pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager')
- readme_python_path = pattern_resource_manager.search(self.readme_link).group() + '/readme.python.md'
+ readme_python_path = self.pattern_resource_manager.search(self.readme_link).group() + '/readme.python.md'
contents = str(self.issue_package.rest_repo.get_contents(readme_python_path).decoded_content)
pattern_package = re.compile(r'package-name: [\w+-.]+')
+ pattern_output = re.compile(r'\$\(python-sdks-folder\)/(.*?)/azure-')
self.package_name = pattern_package.search(contents).group().split(':')[-1].strip()
+ self.output_folder = pattern_output.search(contents).group().split('/')[1]
+ self.is_multiapi = ('MultiAPI' in self.issue_package.issue.labels) or ('multi-api' in contents)
def get_edit_content(self) -> None:
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
+ @property
+ def readme_comparison(self) -> bool:
+ # to see whether need change readme
+ if 'package-' not in self.target_readme_tag:
+ return True
+ if _CONFIGURED in self.issue_package.issue.labels:
+ return False
+ readme_path = self.pattern_resource_manager.search(self.readme_link).group()
+ contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content)
+ pattern_tag = re.compile(r'tag: package-[\w+-.]+')
+ package_tags = pattern_tag.findall(contents)
+ whether_same_tag = self.target_readme_tag in package_tags
+ whether_change_readme = not whether_same_tag or self.is_multiapi
+ return whether_change_readme
+
+ def auto_reply(self) -> None:
+ if self.issue_package.issue.comments == 0 or _CONFIGURED in self.issue_package.labels_name:
+ issue_number = self.issue_package.issue.number
+ if not self.readme_comparison:
+ issue_link = self.issue_package.issue.html_url
+ release_pipeline_url = get_python_release_pipeline(self.output_folder)
+ res_run = run_pipeline(issue_link=issue_link,
+ pipeline_url=release_pipeline_url,
+ spec_readme=self.readme_link
+ )
+ if res_run:
+ self.log(f'{issue_number} run pipeline successfully')
+ if _CONFIGURED in self.issue_package.labels_name:
+ self.issue_package.issue.remove_from_labels(_CONFIGURED)
+ else:
+ self.log(f'{issue_number} run pipeline fail')
+ self.issue_package.issue.add_to_labels(_AUTO_ASK_FOR_CHECK)
+ else:
+ self.log(f'issue {issue_number} need config readme')
+
def auto_close(self) -> None:
if AUTO_CLOSE_LABEL in self.issue_package.labels_name:
return
@@ -49,10 +95,12 @@ def auto_close(self) -> None:
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
def run(self) -> None:
- self.get_package_name()
+ self.get_package_and_output()
super().run()
+ self.auto_reply()
self.auto_close()
+
class Python(Common):
def __init__(self, issues, language_owner):
super(Python, self).__init__(issues, language_owner)
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index 17ce9bc7285e..ebcd1db62cf0 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -1,11 +1,16 @@
import datetime
import logging
+import os
+import re
from typing import List, Any
from bs4 import BeautifulSoup
from github.Issue import Issue
from github.Repository import Repository
import requests
+from azure.devops.v6_0.pipelines.pipelines_client import PipelinesClient
+from azure.devops.v6_0.pipelines import models
+from msrest.authentication import BasicAuthentication
REQUEST_REPO = 'Azure/sdk-release-request'
REST_REPO = 'Azure/azure-rest-api-specs'
@@ -49,6 +54,67 @@ def get_last_released_date(package_name: str) -> (str, str):
return last_version, last_version_date
+# get python release pipeline link from web
+def get_python_release_pipeline(output_folder):
+ pipeline_client = PipelinesClient(base_url='https://dev.azure.com/azure-sdk',
+ creds=BasicAuthentication(os.getenv('PIPELINE_TOKEN'), ''))
+ pipelines = pipeline_client.list_pipelines(project='internal')
+ for pipeline in pipelines:
+ if re.findall('^python - \w*$', pipeline.name):
+ key = pipeline.name.replace('python - ', '')
+ if key == output_folder:
+ pipeline_url = 'https://dev.azure.com/azure-sdk/internal/_build?definitionId={}'.format(pipeline.id)
+ return pipeline_url
+ else:
+ _LOG.info('Cannot find definitionId, Do not display pipeline_url')
+ return ''
+
+
+# Run sdk-auto-release(main) to generate SDK
+def run_pipeline(issue_link, pipeline_url, spec_readme):
+ paramaters = {
+ "stages_to_skip": [],
+ "resources": {
+ "repositories": {
+ "self": {
+ "refName": "refs/heads/main"
+ }
+ }
+ },
+ "variables": {
+ "BASE_BRANCH": {
+ "value": "",
+ "isSecret": False
+ },
+ "ISSUE_LINK": {
+ "value": issue_link,
+ "isSecret": False
+ },
+ "PIPELINE_LINK": {
+ "value": pipeline_url,
+ "isSecret": False
+ },
+ "SPEC_README": {
+ "value": spec_readme,
+ "isSecret": False
+ }
+ }
+ }
+ # Fill in with your personal access token and org URL
+ personal_access_token = os.getenv('PIPELINE_TOKEN')
+ organization_url = 'https://dev.azure.com/azure-sdk'
+
+ # Create a connection to the org
+ credentials = BasicAuthentication('', personal_access_token)
+ run_parameters = models.RunPipelineParameters(**paramaters)
+ client = PipelinesClient(base_url=organization_url, creds=credentials)
+ result = client.run_pipeline(project='internal', pipeline_id=2500, run_parameters=run_parameters)
+ if result.state == 'inProgress':
+ return True
+ else:
+ return False
+
+
def record_release(package_name: str, issue_info: Any, file: str) -> None:
created_at = issue_info.created_at.strftime('%Y-%m-%d')
closed_at = issue_info.closed_at.strftime('%Y-%m-%d')
From f8e47192437b4b3504ff3c4df978e176e8f2c346 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 21 Jun 2022 16:55:49 +0800
Subject: [PATCH 068/103] fix
---
scripts/release_helper/python.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index cbd11a3c010c..36199f48a41f 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -19,7 +19,7 @@ class IssueProcessPython(IssueProcess):
def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Repository],
assignee_candidates: Set[str], language_owner: Set[str]):
- IssueProcess.__init__(issue_package, request_repo_dict, assignee_candidates, language_owner)
+ IssueProcess.__init__(self, issue_package, request_repo_dict, assignee_candidates, language_owner)
self.output_folder = ''
self.is_multiapi = False
self.pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager')
From aef194746db9bb4ffaa36012b1044edb68f4671c Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 21 Jun 2022 17:03:23 +0800
Subject: [PATCH 069/103] debug
---
scripts/release_helper/python.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 36199f48a41f..27761a2c9019 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -79,6 +79,7 @@ def auto_reply(self) -> None:
self.log(f'{issue_number} run pipeline fail')
self.issue_package.issue.add_to_labels(_AUTO_ASK_FOR_CHECK)
else:
+ print(f'*** issue {issue_number} need config readme')
self.log(f'issue {issue_number} need config readme')
def auto_close(self) -> None:
From b0b63ef214aca8fec8225f811d23db85b9406c43 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 21 Jun 2022 17:20:38 +0800
Subject: [PATCH 070/103] fix
---
scripts/release_helper/python.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 27761a2c9019..4fc69398c6f8 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -53,7 +53,7 @@ def readme_comparison(self) -> bool:
return True
if _CONFIGURED in self.issue_package.issue.labels:
return False
- readme_path = self.pattern_resource_manager.search(self.readme_link).group()
+ readme_path = self.pattern_resource_manager.search(self.readme_link).group() + '/readme.md'
contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content)
pattern_tag = re.compile(r'tag: package-[\w+-.]+')
package_tags = pattern_tag.findall(contents)
From d1d4799d66a6c80b522692c568afb0c374ee0aef Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 22 Jun 2022 11:00:35 +0800
Subject: [PATCH 071/103] debug
---
scripts/release_helper/python.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 4fc69398c6f8..87021ae8e621 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -49,6 +49,7 @@ def get_edit_content(self) -> None:
@property
def readme_comparison(self) -> bool:
# to see whether need change readme
+ self.log(f'**** target_readme_tag: {self.target_readme_tag}')
if 'package-' not in self.target_readme_tag:
return True
if _CONFIGURED in self.issue_package.issue.labels:
From d74825f6503ee2c85b4b0837b8463208877105dc Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 22 Jun 2022 11:06:32 +0800
Subject: [PATCH 072/103] debug
---
scripts/release_helper/python.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 87021ae8e621..693b0afe81e4 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -60,6 +60,7 @@ def readme_comparison(self) -> bool:
package_tags = pattern_tag.findall(contents)
whether_same_tag = self.target_readme_tag in package_tags
whether_change_readme = not whether_same_tag or self.is_multiapi
+ self.log(f'**** whether_change_readme: {whether_change_readme}')
return whether_change_readme
def auto_reply(self) -> None:
From a8f43084b74a0220e0db58ca34ee178bc39476b1 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 22 Jun 2022 11:13:14 +0800
Subject: [PATCH 073/103] fix
---
scripts/release_helper/python.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 693b0afe81e4..5728d689b048 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -41,7 +41,7 @@ def get_package_and_output(self) -> None:
pattern_output = re.compile(r'\$\(python-sdks-folder\)/(.*?)/azure-')
self.package_name = pattern_package.search(contents).group().split(':')[-1].strip()
self.output_folder = pattern_output.search(contents).group().split('/')[1]
- self.is_multiapi = ('MultiAPI' in self.issue_package.issue.labels) or ('multi-api' in contents)
+ self.is_multiapi = ('MultiAPI' in self.issue_package.labels_name) or ('multi-api' in contents)
def get_edit_content(self) -> None:
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
@@ -49,10 +49,10 @@ def get_edit_content(self) -> None:
@property
def readme_comparison(self) -> bool:
# to see whether need change readme
- self.log(f'**** target_readme_tag: {self.target_readme_tag}')
+ self.log(f'**** issue_package.labels_name: {self.issue_package.labels_name}')
if 'package-' not in self.target_readme_tag:
return True
- if _CONFIGURED in self.issue_package.issue.labels:
+ if _CONFIGURED in self.issue_package.labels_name:
return False
readme_path = self.pattern_resource_manager.search(self.readme_link).group() + '/readme.md'
contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content)
@@ -60,7 +60,6 @@ def readme_comparison(self) -> bool:
package_tags = pattern_tag.findall(contents)
whether_same_tag = self.target_readme_tag in package_tags
whether_change_readme = not whether_same_tag or self.is_multiapi
- self.log(f'**** whether_change_readme: {whether_change_readme}')
return whether_change_readme
def auto_reply(self) -> None:
From 87f2ebef2404586c102d4d98677483447b637ae3 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 22 Jun 2022 11:24:16 +0800
Subject: [PATCH 074/103] debugg
---
scripts/release_helper/python.py | 2 +-
scripts/release_helper/utils.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 5728d689b048..f1c5671c9cbd 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -70,7 +70,7 @@ def auto_reply(self) -> None:
release_pipeline_url = get_python_release_pipeline(self.output_folder)
res_run = run_pipeline(issue_link=issue_link,
pipeline_url=release_pipeline_url,
- spec_readme=self.readme_link
+ spec_readme=self.readme_link + '/readme.md'
)
if res_run:
self.log(f'{issue_number} run pipeline successfully')
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index ebcd1db62cf0..5dd03324d223 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -59,11 +59,13 @@ def get_python_release_pipeline(output_folder):
pipeline_client = PipelinesClient(base_url='https://dev.azure.com/azure-sdk',
creds=BasicAuthentication(os.getenv('PIPELINE_TOKEN'), ''))
pipelines = pipeline_client.list_pipelines(project='internal')
+ _LOG.info('**** list pipelines successfully')
for pipeline in pipelines:
if re.findall('^python - \w*$', pipeline.name):
key = pipeline.name.replace('python - ', '')
if key == output_folder:
pipeline_url = 'https://dev.azure.com/azure-sdk/internal/_build?definitionId={}'.format(pipeline.id)
+ _LOG.info(f'**** find pepeline.id: {pipeline.id} successfully')
return pipeline_url
else:
_LOG.info('Cannot find definitionId, Do not display pipeline_url')
@@ -100,6 +102,7 @@ def run_pipeline(issue_link, pipeline_url, spec_readme):
}
}
}
+ _LOG.info(f'**** parameters: {paramaters}')
# Fill in with your personal access token and org URL
personal_access_token = os.getenv('PIPELINE_TOKEN')
organization_url = 'https://dev.azure.com/azure-sdk'
From 4fce70c4d0f047e2623d9b0ca67ac98796a1bc5d Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Thu, 23 Jun 2022 10:17:25 +0800
Subject: [PATCH 075/103] update yaml
---
scripts/release_helper/release_helper.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/release_helper/release_helper.yml b/scripts/release_helper/release_helper.yml
index 1eaac9e3c486..9d231db952f9 100644
--- a/scripts/release_helper/release_helper.yml
+++ b/scripts/release_helper/release_helper.yml
@@ -54,10 +54,8 @@ jobs:
# import env variable
export TOKEN=$(Yuchao-GitToken)
- export PYTHON_BIGCAT_TOKEN=$(Jiefeng-GitToken)
- export PYTHON_ZED_TOKEN=$(Zed-GitToken)
- export PYTHON_MSYYC_TOKEN=$(Yuchao-GitToken)
export AZURESDK_BOT_TOKEN=$(azuresdk-github-pat)
+ export PIPELINE_TOKEN=$(PIPELINE-TOKEN)
export LANGUAGE=$(RUN_LANGUAGE)
From b01e55db6f447c6a4b6e66cb4365ef972296cf8b Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Thu, 23 Jun 2022 17:15:47 +0800
Subject: [PATCH 076/103] change to add_label
---
scripts/release_helper/python.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index f1c5671c9cbd..e864852adf2a 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -49,7 +49,6 @@ def get_edit_content(self) -> None:
@property
def readme_comparison(self) -> bool:
# to see whether need change readme
- self.log(f'**** issue_package.labels_name: {self.issue_package.labels_name}')
if 'package-' not in self.target_readme_tag:
return True
if _CONFIGURED in self.issue_package.labels_name:
@@ -78,9 +77,8 @@ def auto_reply(self) -> None:
self.issue_package.issue.remove_from_labels(_CONFIGURED)
else:
self.log(f'{issue_number} run pipeline fail')
- self.issue_package.issue.add_to_labels(_AUTO_ASK_FOR_CHECK)
+ self.add_label(_AUTO_ASK_FOR_CHECK)
else:
- print(f'*** issue {issue_number} need config readme')
self.log(f'issue {issue_number} need config readme')
def auto_close(self) -> None:
@@ -91,7 +89,7 @@ def auto_close(self) -> None:
comment = f'Hi @{self.owner}, pypi link: https://pypi.org/project/{self.package_name}/{last_version}/'
self.issue_package.issue.create_comment(body=comment)
self.issue_package.issue.edit(state='closed')
- self.issue_package.issue.add_to_labels('auto-closed')
+ self.add_label('auto-closed')
self.is_open = False
self.log(f"{self.issue_package.issue.number} has been closed!")
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
From 9d18dfeb15620fb7141a97879de92900f52f9649 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Thu, 23 Jun 2022 17:16:41 +0800
Subject: [PATCH 077/103] format
---
scripts/release_helper/python.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index e864852adf2a..8d11123557c3 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -89,7 +89,7 @@ def auto_close(self) -> None:
comment = f'Hi @{self.owner}, pypi link: https://pypi.org/project/{self.package_name}/{last_version}/'
self.issue_package.issue.create_comment(body=comment)
self.issue_package.issue.edit(state='closed')
- self.add_label('auto-closed')
+ self.add_label(AUTO_CLOSE_LABEL)
self.is_open = False
self.log(f"{self.issue_package.issue.number} has been closed!")
record_release(self.package_name, self.issue_package.issue, _FILE_OUT)
From 2f28e57df49e5f3d27f31786ea9de502611fe3ac Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Fri, 24 Jun 2022 13:46:25 +0800
Subject: [PATCH 078/103] add attention policy and remind policy
---
scripts/release_helper/python.py | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 8d11123557c3..298c3c00c7b2 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -1,3 +1,4 @@
+from datetime import datetime
import re
from typing import Any, List, Dict, Set
@@ -11,6 +12,8 @@
# labels
_CONFIGURED = 'Configured'
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
+_BRANCH_ATTENTION = 'base-branch-attention'
+_7_DAY_ATTENTION = '7days attention'
# record published issues
_FILE_OUT = 'published_issues_python.csv'
@@ -23,6 +26,13 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.output_folder = ''
self.is_multiapi = False
self.pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager')
+ self.delay_time = self.get_delay_time()
+
+ def get_delay_time(self):
+ q = [comment.updated_at
+ for comment in self.issue_package.issue.get_comments() if comment.user.login not in _PYTHON_OWNER]
+ q.sort()
+ return (datetime.now() - (self.created_time if not q else q[-1])).days
def init_readme_link(self) -> None:
issue_body_list = self.get_issue_body()
@@ -81,6 +91,27 @@ def auto_reply(self) -> None:
else:
self.log(f'issue {issue_number} need config readme')
+ def attention_policy(self):
+ if _BRANCH_ATTENTION in self.issue_package.labels_name:
+ self.bot_advice.append('new version is 0.0.0, please check base branch!')
+
+ def remind_policy(self):
+ if self.delay_time >= 15 and _7_DAY_ATTENTION in self.issue_package.labels_name and self.date_from_target < 0:
+ self.comment(
+ f'hi @{self.owner}, the issue is closed since there is no reply for a long time. '
+ 'Please reopen it if necessary or create new one.')
+ self.issue_package.issue.edit(state='close')
+ elif self.delay_time >= 7 and _7_DAY_ATTENTION not in self.issue_package.labels_name and self.date_from_target < 7:
+ self.comment(
+ f'hi @{self.owner}, this release-request has been delayed more than 7 days,'
+ ' please deal with it ASAP. We will close the issue if there is still no response after 7 days!')
+ self.add_label(_7_DAY_ATTENTION)
+
+ def auto_bot_advice(self):
+ super().auto_bot_advice()
+ self.attention_policy()
+ self.remind_policy()
+
def auto_close(self) -> None:
if AUTO_CLOSE_LABEL in self.issue_package.labels_name:
return
From 85330b5718487405ccc743bbc7986dc79b0006d7 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Mon, 27 Jun 2022 13:48:10 +0800
Subject: [PATCH 079/103] add duplicated policy
---
scripts/release_helper/common.py | 17 +++++++++++------
scripts/release_helper/python.py | 12 ++++++++++++
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 37e6fbfaec37..97d6c48f5f4a 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -312,6 +312,9 @@ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
for assignee in self.assignee_candidates:
self.request_repo_dict[assignee] = Github(assignee_token).get_repo(REQUEST_REPO)
+ def log_error(self, message: str) -> None:
+ _LOG.error(message)
+
def output(self):
with open(self.file_out_name, 'w') as file_out:
file_out.write('| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
@@ -322,7 +325,7 @@ def output(self):
item_status = Common.output_md(item)
file_out.write(item_status)
except Exception as e:
- _LOG.error(f'Error happened during output result of handled issue {item.issue_package.issue.number}: {e}')
+ self.log_error(f'Error happened during output result of handled issue {item.issue_package.issue.number}: {e}')
@staticmethod
def output_md(item: IssueProcess):
@@ -344,17 +347,19 @@ def output_md(item: IssueProcess):
item.print_date_from_target_date()
)
- def run(self):
- items = []
+ def get_result(self):
for item in self.issues_package:
- issue = self.issue_process_function(item, self.request_repo_dict, self.assignee_candidates, self.language_owner)
+ issue = self.issue_process_function(item, self.request_repo_dict, self.assignee_candidates,
+ self.language_owner)
try:
issue.run()
self.result.append(issue)
except Exception as e:
- _LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
- self.output()
+ self.log_error(f'Error happened during handling issue {item.issue.number}: {e}')
+ def run(self):
+ self.get_result()
+ self.output()
def common_process(issues: List[IssuePackage]):
instance = Common(issues, _LANGUAGE_OWNER)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 298c3c00c7b2..ff0727e15711 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -1,4 +1,5 @@
from datetime import datetime
+from collections import Counter
import re
from typing import Any, List, Dict, Set
@@ -138,6 +139,17 @@ def __init__(self, issues, language_owner):
self.file_out_name = 'release_python_status.md'
self.issue_process_function = IssueProcessPython
+ def duplicated_policy(self):
+ count = Counter([item.package_name for item in self.result])
+ for item in self.result:
+ if count[item.package_name] > 1:
+ item.bot_advice.insert(0, 'duplicated issue
')
+
+ def run(self):
+ self.get_result()
+ self.duplicated_policy()
+ self.output()
+
def python_process(issues: List[Any]):
instance = Python(issues, _PYTHON_OWNER)
From 65e5deb7f954f8b692145c08cd079569ee95c779 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Mon, 27 Jun 2022 14:10:00 +0800
Subject: [PATCH 080/103] delete uesless code
---
scripts/release_helper/utils.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index 5dd03324d223..ebcd1db62cf0 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -59,13 +59,11 @@ def get_python_release_pipeline(output_folder):
pipeline_client = PipelinesClient(base_url='https://dev.azure.com/azure-sdk',
creds=BasicAuthentication(os.getenv('PIPELINE_TOKEN'), ''))
pipelines = pipeline_client.list_pipelines(project='internal')
- _LOG.info('**** list pipelines successfully')
for pipeline in pipelines:
if re.findall('^python - \w*$', pipeline.name):
key = pipeline.name.replace('python - ', '')
if key == output_folder:
pipeline_url = 'https://dev.azure.com/azure-sdk/internal/_build?definitionId={}'.format(pipeline.id)
- _LOG.info(f'**** find pepeline.id: {pipeline.id} successfully')
return pipeline_url
else:
_LOG.info('Cannot find definitionId, Do not display pipeline_url')
@@ -102,7 +100,6 @@ def run_pipeline(issue_link, pipeline_url, spec_readme):
}
}
}
- _LOG.info(f'**** parameters: {paramaters}')
# Fill in with your personal access token and org URL
personal_access_token = os.getenv('PIPELINE_TOKEN')
organization_url = 'https://dev.azure.com/azure-sdk'
From 788a451a4a572514c7df17d5ecc434e3d6ab5b6f Mon Sep 17 00:00:00 2001
From: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com>
Date: Tue, 28 Jun 2022 10:04:15 +0800
Subject: [PATCH 081/103] Update scripts/release_helper/utils.py
Co-authored-by: Yuchao Yan
---
scripts/release_helper/utils.py | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index ebcd1db62cf0..9da67f75c7e2 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -109,10 +109,7 @@ def run_pipeline(issue_link, pipeline_url, spec_readme):
run_parameters = models.RunPipelineParameters(**paramaters)
client = PipelinesClient(base_url=organization_url, creds=credentials)
result = client.run_pipeline(project='internal', pipeline_id=2500, run_parameters=run_parameters)
- if result.state == 'inProgress':
- return True
- else:
- return False
+ return result.state == 'inProgress':
def record_release(package_name: str, issue_info: Any, file: str) -> None:
From d1fc2334a26ac2d87f0f2abc827ef54dee61c229 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 28 Jun 2022 10:37:23 +0800
Subject: [PATCH 082/103] update
---
scripts/release_helper/common.py | 12 ++++++------
scripts/release_helper/go.py | 7 ++++---
scripts/release_helper/python.py | 6 +++---
scripts/release_helper/release_helper.yml | 1 -
scripts/release_helper/requirement.txt | 11 +++++------
scripts/release_helper/utils.py | 2 +-
6 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 97d6c48f5f4a..6000a52e9016 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -295,11 +295,11 @@ class Common:
file_out_name = '' # file that storages issue status
"""
- def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str], assignee_token=_ASSIGNEE_TOKEN):
+ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
+ skipped_assignees: Set[str]={_BOT_NAME}, assignee_token=_ASSIGNEE_TOKEN):
self.issues_package = issues_package
- self.language_owner = language_owner.copy()
- language_owner.discard(_BOT_NAME)
- self.assignee_candidates = language_owner
+ self.language_owner = language_owner
+ self.assignee_candidates = language_owner - skipped_assignees
# arguments add to language.md
self.file_out_name = 'common.md'
self.target_release_date = ''
@@ -347,7 +347,7 @@ def output_md(item: IssueProcess):
item.print_date_from_target_date()
)
- def get_result(self):
+ def proc_issue(self):
for item in self.issues_package:
issue = self.issue_process_function(item, self.request_repo_dict, self.assignee_candidates,
self.language_owner)
@@ -358,7 +358,7 @@ def get_result(self):
self.log_error(f'Error happened during handling issue {item.issue.number}: {e}')
def run(self):
- self.get_result()
+ self.proc_issue()
self.output()
def common_process(issues: List[IssuePackage]):
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index bbb013b4f230..2b242cbd1c63 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -4,6 +4,7 @@
# assignee dict which will be assigned to handle issues
_GO_OWNER = {'ArcturusZhang', 'Alancere', 'azure-sdk'}
+_SKIPPED_ASSIGNEES = {'ArcturusZhang', 'azure-sdk'}
class IssueProcessGo(IssueProcess):
@@ -11,11 +12,11 @@ class IssueProcessGo(IssueProcess):
class Go(Common):
- def __init__(self, issues, language_owner):
- super(Go, self).__init__(issues, language_owner)
+ def __init__(self, issues, language_owner, skipped_assignees):
+ super(Go, self).__init__(issues, language_owner, skipped_assignees)
self.file_out_name = 'release_go_status.md'
def go_process(issues: List[Any]):
- instance = Go(issues, _GO_OWNER)
+ instance = Go(issues, _GO_OWNER, _SKIPPED_ASSIGNEES)
instance.run()
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index ff0727e15711..dd296da5e17c 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -140,13 +140,13 @@ def __init__(self, issues, language_owner):
self.issue_process_function = IssueProcessPython
def duplicated_policy(self):
- count = Counter([item.package_name for item in self.result])
+ counter = Counter([item.package_name for item in self.result])
for item in self.result:
- if count[item.package_name] > 1:
+ if counter[item.package_name] > 1:
item.bot_advice.insert(0, 'duplicated issue
')
def run(self):
- self.get_result()
+ self.proc_issue()
self.duplicated_policy()
self.output()
diff --git a/scripts/release_helper/release_helper.yml b/scripts/release_helper/release_helper.yml
index 9d231db952f9..6f4762a0023a 100644
--- a/scripts/release_helper/release_helper.yml
+++ b/scripts/release_helper/release_helper.yml
@@ -53,7 +53,6 @@ jobs:
git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage
# import env variable
- export TOKEN=$(Yuchao-GitToken)
export AZURESDK_BOT_TOKEN=$(azuresdk-github-pat)
export PIPELINE_TOKEN=$(PIPELINE-TOKEN)
export LANGUAGE=$(RUN_LANGUAGE)
diff --git a/scripts/release_helper/requirement.txt b/scripts/release_helper/requirement.txt
index 95f800db46db..db29417ad6ee 100644
--- a/scripts/release_helper/requirement.txt
+++ b/scripts/release_helper/requirement.txt
@@ -1,6 +1,5 @@
-PyGithub
-datetime
-requests
-bs4
-azure-devops
-msrest
+PyGithub==1.55
+requests==2.28.0
+beautifulsoup4==4.11.1
+azure-devops==6.0.0b4
+msrest==0.7.1
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index 9da67f75c7e2..a336a55d7b30 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -109,7 +109,7 @@ def run_pipeline(issue_link, pipeline_url, spec_readme):
run_parameters = models.RunPipelineParameters(**paramaters)
client = PipelinesClient(base_url=organization_url, creds=credentials)
result = client.run_pipeline(project='internal', pipeline_id=2500, run_parameters=run_parameters)
- return result.state == 'inProgress':
+ return result.state == 'inProgress'
def record_release(package_name: str, issue_info: Any, file: str) -> None:
From 7e2ddb5c32ff22c67d41ec04b11491246770ddbe Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 28 Jun 2022 10:48:44 +0800
Subject: [PATCH 083/103] fix dependence version
---
scripts/release_helper/requirement.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/requirement.txt b/scripts/release_helper/requirement.txt
index db29417ad6ee..496b2cd3ba34 100644
--- a/scripts/release_helper/requirement.txt
+++ b/scripts/release_helper/requirement.txt
@@ -2,4 +2,4 @@ PyGithub==1.55
requests==2.28.0
beautifulsoup4==4.11.1
azure-devops==6.0.0b4
-msrest==0.7.1
+msrest==0.7.0
From 388b37341b6ff6de9ef088c37bbd0057be91683d Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 28 Jun 2022 10:53:05 +0800
Subject: [PATCH 084/103] fix dependence version
---
scripts/release_helper/requirement.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/requirement.txt b/scripts/release_helper/requirement.txt
index 496b2cd3ba34..6e304533109b 100644
--- a/scripts/release_helper/requirement.txt
+++ b/scripts/release_helper/requirement.txt
@@ -2,4 +2,4 @@ PyGithub==1.55
requests==2.28.0
beautifulsoup4==4.11.1
azure-devops==6.0.0b4
-msrest==0.7.0
+msrest>=0.6.21
From b7eb450f98fbd2b177356813163014c3e0df9613 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 28 Jun 2022 10:57:55 +0800
Subject: [PATCH 085/103] fix env
---
scripts/release_helper/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/main.py b/scripts/release_helper/main.py
index 2f382a601dac..941fb7f0ade1 100644
--- a/scripts/release_helper/main.py
+++ b/scripts/release_helper/main.py
@@ -34,7 +34,7 @@
def collect_open_issues() -> List[IssuePackage]:
- hub = Github(os.getenv('TOKEN'))
+ hub = Github(os.getenv('AZURESDK_BOT_TOKEN'))
request_repo = hub.get_repo(REQUEST_REPO)
mgmt_label = request_repo.get_label('ManagementPlane')
open_issues = request_repo.get_issues(state='open', labels=[mgmt_label])
From 2ee48d1d138c73463b3d62110e6839ab85e99f56 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 28 Jun 2022 11:10:29 +0800
Subject: [PATCH 086/103] update js assignee
---
scripts/release_helper/js.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index 7bcdcdcf460a..d3d192225571 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -5,6 +5,7 @@
# assignee dict which will be assigned to handle issues
_JS_OWNER = {'qiaozha', 'lirenhe', 'MaryGao', 'azure-sdk'}
+_SKIPPED_ASSIGNEES = {'lirenhe', 'kazrael2119', 'azure-sdk'}
class IssueProcessJs(IssueProcess):
@@ -17,11 +18,11 @@ def auto_assign_policy(self) -> str:
class Js(Common):
- def __init__(self, issues, language_owner):
- super(Js, self).__init__(issues, language_owner)
+ def __init__(self, issues, language_owner, skipped_assignees):
+ super(Js, self).__init__(issues, language_owner, skipped_assignees)
self.file_out_name = 'release_js_status.md'
self.issue_process_function = IssueProcessJs
def js_process(issues: List[Any]):
- instance = Js(issues, _JS_OWNER)
+ instance = Js(issues, _JS_OWNER, _SKIPPED_ASSIGNEES)
instance.run()
From 07509ade034b43ac465e31639a5bec83f88a293d Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 28 Jun 2022 11:17:02 +0800
Subject: [PATCH 087/103] update js assignee
---
scripts/release_helper/js.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index d3d192225571..a21286533c3c 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -4,7 +4,7 @@
import os
# assignee dict which will be assigned to handle issues
-_JS_OWNER = {'qiaozha', 'lirenhe', 'MaryGao', 'azure-sdk'}
+_JS_OWNER = {'qiaozha', 'lirenhe', 'MaryGao', 'kazrael2119', 'azure-sdk'}
_SKIPPED_ASSIGNEES = {'lirenhe', 'kazrael2119', 'azure-sdk'}
From 1d5f58a9ec4881fe4da3708cdda59dafa363d6c7 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 29 Jun 2022 09:40:07 +0800
Subject: [PATCH 088/103] fix find pr number bug
---
scripts/release_helper/common.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 6000a52e9016..20504af80417 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -80,7 +80,7 @@ def comment(self, message: str) -> None:
self.issue_package.issue.create_comment(message)
def get_readme_from_pr_link(self, link: str) -> str:
- pr_number = int(link.replace(f"{_SWAGGER_PULL}/", "").strip('/'))
+ pr_number = int(link.replace(f"{_SWAGGER_PULL}/", "").split('/')[0])
# Get Readme link
pr_info = self.issue_package.rest_repo.get_pull(number=pr_number)
From 603e3a761b81175d23ef9f2de8185ddc12965569 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 29 Jun 2022 10:15:06 +0800
Subject: [PATCH 089/103] update assignee logic
---
scripts/release_helper/common.py | 6 +++---
scripts/release_helper/go.py | 10 +++++-----
scripts/release_helper/java.py | 10 +++++-----
scripts/release_helper/js.py | 10 +++++-----
scripts/release_helper/python.py | 9 +++++----
5 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 20504af80417..7a960f5df2a9 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -296,10 +296,10 @@ class Common:
"""
def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
- skipped_assignees: Set[str]={_BOT_NAME}, assignee_token=_ASSIGNEE_TOKEN):
+ sdk_assignees: Set[str], assignee_token=_ASSIGNEE_TOKEN):
self.issues_package = issues_package
- self.language_owner = language_owner
- self.assignee_candidates = language_owner - skipped_assignees
+ self.language_owner = language_owner | sdk_assignees
+ self.assignee_candidates = sdk_assignees
# arguments add to language.md
self.file_out_name = 'common.md'
self.target_release_date = ''
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index 2b242cbd1c63..1825520aa4dc 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -3,8 +3,8 @@
import os
# assignee dict which will be assigned to handle issues
-_GO_OWNER = {'ArcturusZhang', 'Alancere', 'azure-sdk'}
-_SKIPPED_ASSIGNEES = {'ArcturusZhang', 'azure-sdk'}
+_GO_OWNER = {'ArcturusZhang', 'azure-sdk'}
+_GO_ASSIGNEE = {'Alancere'}
class IssueProcessGo(IssueProcess):
@@ -12,11 +12,11 @@ class IssueProcessGo(IssueProcess):
class Go(Common):
- def __init__(self, issues, language_owner, skipped_assignees):
- super(Go, self).__init__(issues, language_owner, skipped_assignees)
+ def __init__(self, issues, language_owner, sdk_assignees):
+ super(Go, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_go_status.md'
def go_process(issues: List[Any]):
- instance = Go(issues, _GO_OWNER, _SKIPPED_ASSIGNEES)
+ instance = Go(issues, _GO_OWNER, _GO_ASSIGNEE)
instance.run()
diff --git a/scripts/release_helper/java.py b/scripts/release_helper/java.py
index 121620a2fcf4..a5b6e0260387 100644
--- a/scripts/release_helper/java.py
+++ b/scripts/release_helper/java.py
@@ -4,19 +4,19 @@
import os
# assignee dict which will be assigned to handle issues
-_JAVA_OWNER = {'weidongxu-microsoft', 'haolingdong-msft', 'XiaofeiCao', 'azure-sdk'}
-
+_JAVA_OWNER = {'azure-sdk'}
+_JS_ASSIGNEE = {'weidongxu-microsoft', 'haolingdong-msft', 'XiaofeiCao'}
class IssueProcessJava(IssueProcess):
pass
class Java(Common):
- def __init__(self, issues, language_owner):
- super(Java, self).__init__(issues, language_owner)
+ def __init__(self, issues, language_owner, sdk_assignees):
+ super(Java, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_java_status.md'
def java_process(issues: List[Any]):
- instance = Java(issues, _JAVA_OWNER)
+ instance = Java(issues, _JAVA_OWNER, _JS_ASSIGNEE)
instance.run()
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index a21286533c3c..1713c5315005 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -4,8 +4,8 @@
import os
# assignee dict which will be assigned to handle issues
-_JS_OWNER = {'qiaozha', 'lirenhe', 'MaryGao', 'kazrael2119', 'azure-sdk'}
-_SKIPPED_ASSIGNEES = {'lirenhe', 'kazrael2119', 'azure-sdk'}
+_JS_OWNER = {'lirenhe', 'kazrael2119', 'azure-sdk'}
+_JS_ASSIGNEE = {'qiaozha', 'MaryGao'}
class IssueProcessJs(IssueProcess):
@@ -18,11 +18,11 @@ def auto_assign_policy(self) -> str:
class Js(Common):
- def __init__(self, issues, language_owner, skipped_assignees):
- super(Js, self).__init__(issues, language_owner, skipped_assignees)
+ def __init__(self, issues, language_owner, sdk_assignees):
+ super(Js, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_js_status.md'
self.issue_process_function = IssueProcessJs
def js_process(issues: List[Any]):
- instance = Js(issues, _JS_OWNER, _SKIPPED_ASSIGNEES)
+ instance = Js(issues, _JS_OWNER, _JS_ASSIGNEE)
instance.run()
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index dd296da5e17c..8f8e19fee511 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -9,7 +9,8 @@
from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release, get_python_release_pipeline, run_pipeline
# assignee dict which will be assigned to handle issues
-_PYTHON_OWNER = {'BigCat20196', 'msyyc', 'Wzb123456789', 'azure-sdk'}
+_PYTHON_OWNER = {'msyyc', 'azure-sdk'}
+_PYTHON_ASSIGNEE = {'BigCat20196', 'Wzb123456789'}
# labels
_CONFIGURED = 'Configured'
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
@@ -134,8 +135,8 @@ def run(self) -> None:
class Python(Common):
- def __init__(self, issues, language_owner):
- super(Python, self).__init__(issues, language_owner)
+ def __init__(self, issues, language_owner, sdk_assignees):
+ super(Python, self).__init__(issues, language_owner, sdk_assignees)
self.file_out_name = 'release_python_status.md'
self.issue_process_function = IssueProcessPython
@@ -152,5 +153,5 @@ def run(self):
def python_process(issues: List[Any]):
- instance = Python(issues, _PYTHON_OWNER)
+ instance = Python(issues, _PYTHON_OWNER, _PYTHON_ASSIGNEE)
instance.run()
From 942565590c58d33139cc7f5c820186927ef95453 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 29 Jun 2022 10:39:49 +0800
Subject: [PATCH 090/103] debug
---
scripts/release_helper/common.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 7a960f5df2a9..a25581e340b0 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -299,6 +299,7 @@ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
sdk_assignees: Set[str], assignee_token=_ASSIGNEE_TOKEN):
self.issues_package = issues_package
self.language_owner = language_owner | sdk_assignees
+ print(f"*** language owner:{self.language_owner}")
self.assignee_candidates = sdk_assignees
# arguments add to language.md
self.file_out_name = 'common.md'
@@ -362,5 +363,5 @@ def run(self):
self.output()
def common_process(issues: List[IssuePackage]):
- instance = Common(issues, _LANGUAGE_OWNER)
+ instance = Common(issues, _LANGUAGE_OWNER, _LANGUAGE_OWNER)
instance.run()
From e8afcf3e4035ce2918a12009d79dc96577e27da5 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 29 Jun 2022 11:22:27 +0800
Subject: [PATCH 091/103] debug
---
scripts/release_helper/common.py | 3 ++-
scripts/release_helper/python.py | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index a25581e340b0..c54db047ee71 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -213,7 +213,9 @@ def auto_assign_policy(self) -> str:
def auto_assign(self) -> None:
if AUTO_ASSIGN_LABEL in self.issue_package.labels_name:
self.update_issue_instance()
+ print(f"*** {self.issue_package.issue.number} has assign label")
return
+ print(f"*** {self.issue_package.issue.number} has not assign label")
# assign averagely
assignee = self.auto_assign_policy()
@@ -299,7 +301,6 @@ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
sdk_assignees: Set[str], assignee_token=_ASSIGNEE_TOKEN):
self.issues_package = issues_package
self.language_owner = language_owner | sdk_assignees
- print(f"*** language owner:{self.language_owner}")
self.assignee_candidates = sdk_assignees
# arguments add to language.md
self.file_out_name = 'common.md'
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 8f8e19fee511..55011a69537b 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -32,7 +32,7 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
def get_delay_time(self):
q = [comment.updated_at
- for comment in self.issue_package.issue.get_comments() if comment.user.login not in _PYTHON_OWNER]
+ for comment in self.issue_package.issue.get_comments() if comment.user.login not in self.language_owner]
q.sort()
return (datetime.now() - (self.created_time if not q else q[-1])).days
From 9a89bbe7196f5da4be2bd779cc51b068531be22e Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 29 Jun 2022 14:31:33 +0800
Subject: [PATCH 092/103] update python assignee
---
scripts/release_helper/common.py | 2 --
scripts/release_helper/python.py | 4 ++--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index c54db047ee71..360580a6a059 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -213,9 +213,7 @@ def auto_assign_policy(self) -> str:
def auto_assign(self) -> None:
if AUTO_ASSIGN_LABEL in self.issue_package.labels_name:
self.update_issue_instance()
- print(f"*** {self.issue_package.issue.number} has assign label")
return
- print(f"*** {self.issue_package.issue.number} has not assign label")
# assign averagely
assignee = self.auto_assign_policy()
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 55011a69537b..e73244d43647 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -9,8 +9,8 @@
from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release, get_python_release_pipeline, run_pipeline
# assignee dict which will be assigned to handle issues
-_PYTHON_OWNER = {'msyyc', 'azure-sdk'}
-_PYTHON_ASSIGNEE = {'BigCat20196', 'Wzb123456789'}
+_PYTHON_OWNER = {'azure-sdk'}
+_PYTHON_ASSIGNEE = {'msyyc', 'BigCat20196', 'Wzb123456789'}
# labels
_CONFIGURED = 'Configured'
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
From 9290c646f4f1712ed4195362dfb2c42e031371a2 Mon Sep 17 00:00:00 2001
From: Yuchao Yan
Date: Thu, 30 Jun 2022 10:36:13 +0800
Subject: [PATCH 093/103] Update python.py
---
scripts/release_helper/python.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index e73244d43647..d2dff53b633e 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -9,8 +9,8 @@
from utils import AUTO_CLOSE_LABEL, get_last_released_date, record_release, get_python_release_pipeline, run_pipeline
# assignee dict which will be assigned to handle issues
-_PYTHON_OWNER = {'azure-sdk'}
-_PYTHON_ASSIGNEE = {'msyyc', 'BigCat20196', 'Wzb123456789'}
+_PYTHON_OWNER = {'azure-sdk', 'msyyc'}
+_PYTHON_ASSIGNEE = {'BigCat20196', 'Wzb123456789'}
# labels
_CONFIGURED = 'Configured'
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
From 055c2e72f28eac038cf45d8cfefb69955cf22fb5 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 6 Jul 2022 11:18:25 +0800
Subject: [PATCH 094/103] debug
---
scripts/release_helper/python.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index d2dff53b633e..e378d5243bd5 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -69,6 +69,8 @@ def readme_comparison(self) -> bool:
contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content)
pattern_tag = re.compile(r'tag: package-[\w+-.]+')
package_tags = pattern_tag.findall(contents)
+ print(f"*** self.target_readme_tag: {self.target_readme_tag}")
+ print(f"*** package_tags: {package_tags}")
whether_same_tag = self.target_readme_tag in package_tags
whether_change_readme = not whether_same_tag or self.is_multiapi
return whether_change_readme
From 0c7744f874f52505744bf573d6d5c18eadb03b90 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 6 Jul 2022 11:34:45 +0800
Subject: [PATCH 095/103] debug
---
scripts/release_helper/python.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index e378d5243bd5..0d18ded0bd7a 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -71,7 +71,8 @@ def readme_comparison(self) -> bool:
package_tags = pattern_tag.findall(contents)
print(f"*** self.target_readme_tag: {self.target_readme_tag}")
print(f"*** package_tags: {package_tags}")
- whether_same_tag = self.target_readme_tag in package_tags
+ whether_same_tag = f'tag: {self.target_readme_tag}' in package_tags
+ print(f'whether_same_tag: {whether_same_tag}')
whether_change_readme = not whether_same_tag or self.is_multiapi
return whether_change_readme
From 5642eab9143ae7f21c286fd1986dce373d445704 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Wed, 6 Jul 2022 11:45:43 +0800
Subject: [PATCH 096/103] delete useless code
---
scripts/release_helper/python.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 0d18ded0bd7a..64b4d2055c9d 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -69,10 +69,7 @@ def readme_comparison(self) -> bool:
contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content)
pattern_tag = re.compile(r'tag: package-[\w+-.]+')
package_tags = pattern_tag.findall(contents)
- print(f"*** self.target_readme_tag: {self.target_readme_tag}")
- print(f"*** package_tags: {package_tags}")
whether_same_tag = f'tag: {self.target_readme_tag}' in package_tags
- print(f'whether_same_tag: {whether_same_tag}')
whether_change_readme = not whether_same_tag or self.is_multiapi
return whether_change_readme
From 4918eee32949498e897b0beddfe2c510bf853a50 Mon Sep 17 00:00:00 2001
From: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com>
Date: Wed, 6 Jul 2022 12:52:55 +0800
Subject: [PATCH 097/103] Update scripts/release_helper/python.py
Co-authored-by: Yuchao Yan
---
scripts/release_helper/python.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 64b4d2055c9d..2dabea9a960a 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -69,7 +69,7 @@ def readme_comparison(self) -> bool:
contents = str(self.issue_package.rest_repo.get_contents(readme_path).decoded_content)
pattern_tag = re.compile(r'tag: package-[\w+-.]+')
package_tags = pattern_tag.findall(contents)
- whether_same_tag = f'tag: {self.target_readme_tag}' in package_tags
+ whether_same_tag = self.target_readme_tag in package_tags[0]
whether_change_readme = not whether_same_tag or self.is_multiapi
return whether_change_readme
From c5d19c8dd7a323021b34f04a409294f69af0fdf5 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Thu, 7 Jul 2022 14:17:16 +0800
Subject: [PATCH 098/103] add multi api policy
---
scripts/release_helper/python.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 2dabea9a960a..013448bb802f 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -16,6 +16,7 @@
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
_BRANCH_ATTENTION = 'base-branch-attention'
_7_DAY_ATTENTION = '7days attention'
+_MULTI_API = 'MultiAPI'
# record published issues
_FILE_OUT = 'published_issues_python.csv'
@@ -45,6 +46,12 @@ def init_readme_link(self) -> None:
# get readme_link
self.get_readme_link(origin_link)
+ def multi_api_policy(self) -> None:
+ if self.is_multiapi:
+ self.bot_advice.append('It is a MultiAPI')
+ if _MULTI_API not in self.issue_package.labels_name:
+ self.add_label(_MULTI_API)
+
def get_package_and_output(self) -> None:
self.init_readme_link()
readme_python_path = self.pattern_resource_manager.search(self.readme_link).group() + '/readme.python.md'
@@ -53,7 +60,7 @@ def get_package_and_output(self) -> None:
pattern_output = re.compile(r'\$\(python-sdks-folder\)/(.*?)/azure-')
self.package_name = pattern_package.search(contents).group().split(':')[-1].strip()
self.output_folder = pattern_output.search(contents).group().split('/')[1]
- self.is_multiapi = ('MultiAPI' in self.issue_package.labels_name) or ('multi-api' in contents)
+ self.is_multiapi = (_MULTI_API in self.issue_package.labels_name) or ('multi-api' in contents)
def get_edit_content(self) -> None:
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
@@ -111,6 +118,7 @@ def remind_policy(self):
def auto_bot_advice(self):
super().auto_bot_advice()
+ self.multi_api_policy()
self.attention_policy()
self.remind_policy()
From 53d15db37c9fbd2e866e4808c3346b5e3c33a671 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Fri, 8 Jul 2022 16:21:01 +0800
Subject: [PATCH 099/103] add tag inconsystency
---
scripts/release_helper/python.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 013448bb802f..8c662c7ff977 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -17,6 +17,7 @@
_BRANCH_ATTENTION = 'base-branch-attention'
_7_DAY_ATTENTION = '7days attention'
_MULTI_API = 'MultiAPI'
+_INCONSISTENT_TAG = 'Inconsistent tag'
# record published issues
_FILE_OUT = 'published_issues_python.csv'
@@ -46,6 +47,11 @@ def init_readme_link(self) -> None:
# get readme_link
self.get_readme_link(origin_link)
+ def check_tag_consistency(self) -> None:
+ super().check_tag_consistency()
+ if self.default_readme_tag != self.target_readme_tag:
+ self.add_label(_INCONSISTENT_TAG)
+
def multi_api_policy(self) -> None:
if self.is_multiapi:
self.bot_advice.append('It is a MultiAPI')
@@ -104,6 +110,9 @@ def attention_policy(self):
if _BRANCH_ATTENTION in self.issue_package.labels_name:
self.bot_advice.append('new version is 0.0.0, please check base branch!')
+ if _INCONSISTENT_TAG in self.issue_package.labels_name:
+ self.bot_advice.append('Attention to inconsistent tag')
+
def remind_policy(self):
if self.delay_time >= 15 and _7_DAY_ATTENTION in self.issue_package.labels_name and self.date_from_target < 0:
self.comment(
@@ -122,6 +131,7 @@ def auto_bot_advice(self):
self.attention_policy()
self.remind_policy()
+
def auto_close(self) -> None:
if AUTO_CLOSE_LABEL in self.issue_package.labels_name:
return
From 8483a4d4205a35908a7fca4290594ff27c97de3a Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Mon, 11 Jul 2022 14:02:34 +0800
Subject: [PATCH 100/103] add specified tag
---
scripts/release_helper/common.py | 3 ++-
scripts/release_helper/python.py | 10 ++++++++--
scripts/release_helper/utils.py | 6 +++++-
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 360580a6a059..1861c8b0af27 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -174,7 +174,8 @@ def auto_parse(self) -> None:
issue_body_list = self.get_issue_body()
# Get the origin link and readme tag in issue body
- origin_link, self.target_readme_tag = get_origin_link_and_tag(issue_body_list)
+ origin_link, target_readme_tag = get_origin_link_and_tag(issue_body_list)
+ self.target_readme_tag = target_readme_tag if not self.target_readme_tag else self.target_readme_tag
# get readme_link
self.get_readme_link(origin_link)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 8c662c7ff977..47352594e928 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -31,6 +31,7 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
self.is_multiapi = False
self.pattern_resource_manager = re.compile(r'/specification/([\w-]+/)+resource-manager')
self.delay_time = self.get_delay_time()
+ self.is_specified_tag = False
def get_delay_time(self):
q = [comment.updated_at
@@ -43,11 +44,13 @@ def init_readme_link(self) -> None:
# Get the origin link and readme tag in issue body
origin_link, self.target_readme_tag = get_origin_link_and_tag(issue_body_list)
+ self.is_specified_tag = any('->Readme Tag:' in line for line in issue_body_list)
# get readme_link
self.get_readme_link(origin_link)
def check_tag_consistency(self) -> None:
+ self.target_readme_tag = self.target_readme_tag.replace('tag-', '')
super().check_tag_consistency()
if self.default_readme_tag != self.target_readme_tag:
self.add_label(_INCONSISTENT_TAG)
@@ -69,7 +72,8 @@ def get_package_and_output(self) -> None:
self.is_multiapi = (_MULTI_API in self.issue_package.labels_name) or ('multi-api' in contents)
def get_edit_content(self) -> None:
- self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}'
+ self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}' \
+ f'\nReadme Tag: {self.target_readme_tag}'
@property
def readme_comparison(self) -> bool:
@@ -92,9 +96,11 @@ def auto_reply(self) -> None:
if not self.readme_comparison:
issue_link = self.issue_package.issue.html_url
release_pipeline_url = get_python_release_pipeline(self.output_folder)
+ python_tag = self.target_readme_tag if self.is_specified_tag else ""
res_run = run_pipeline(issue_link=issue_link,
pipeline_url=release_pipeline_url,
- spec_readme=self.readme_link + '/readme.md'
+ spec_readme=self.readme_link + '/readme.md',
+ python_tag=python_tag
)
if res_run:
self.log(f'{issue_number} run pipeline successfully')
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index a336a55d7b30..a26d4c1fbe51 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -71,7 +71,7 @@ def get_python_release_pipeline(output_folder):
# Run sdk-auto-release(main) to generate SDK
-def run_pipeline(issue_link, pipeline_url, spec_readme):
+def run_pipeline(issue_link, pipeline_url, spec_readme, python_tag=""):
paramaters = {
"stages_to_skip": [],
"resources": {
@@ -97,6 +97,10 @@ def run_pipeline(issue_link, pipeline_url, spec_readme):
"SPEC_README": {
"value": spec_readme,
"isSecret": False
+ },
+ "PYTHON_TAG": {
+ "value": python_tag,
+ "isSecret": False
}
}
}
From 891784b75d6c34439eda6a2e6a462310df635866 Mon Sep 17 00:00:00 2001
From: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com>
Date: Tue, 12 Jul 2022 10:13:26 +0800
Subject: [PATCH 101/103] Update scripts/release_helper/python.py
Co-authored-by: Yuchao Yan
---
scripts/release_helper/python.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 47352594e928..99f381367b2a 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -57,7 +57,7 @@ def check_tag_consistency(self) -> None:
def multi_api_policy(self) -> None:
if self.is_multiapi:
- self.bot_advice.append('It is a MultiAPI')
+ self.bot_advice.append('MultiAPI')
if _MULTI_API not in self.issue_package.labels_name:
self.add_label(_MULTI_API)
From 069def5dc35e082b5d738ca78d92582b318053e8 Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 12 Jul 2022 10:26:52 +0800
Subject: [PATCH 102/103] update
---
scripts/release_helper/common.py | 9 ++++++++-
scripts/release_helper/python.py | 18 ++++--------------
scripts/release_helper/utils.py | 1 +
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 1861c8b0af27..562ddd615916 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -11,7 +11,7 @@
from github.Repository import Repository
from utils import IssuePackage, REQUEST_REPO, AUTO_ASSIGN_LABEL, AUTO_PARSE_LABEL, get_origin_link_and_tag,\
- MULTI_LINK_LABEL
+ MULTI_LINK_LABEL, INCONSISTENT_TAG
_LOG = logging.getLogger(__name__)
@@ -159,7 +159,9 @@ def edit_issue_body(self) -> None:
self.issue_package.issue.edit(body=issue_body_up)
def check_tag_consistency(self) -> None:
+ self.target_readme_tag = self.target_readme_tag.replace('tag-', '')
if self.default_readme_tag != self.target_readme_tag:
+ self.add_label(INCONSISTENT_TAG)
self.comment(f'Hi, @{self.owner}, according to [rule](https://github.com/Azure/azure-rest-api-specs/blob/'
f'main/documentation/release-request/rules-for-release-request.md#3-readme-tag-to-be-released),'
f' your **Readme Tag** is `{self.target_readme_tag}`, but in [readme.md]({self.readme_link}#basic-information) '
@@ -253,6 +255,10 @@ def multi_link_policy(self):
if MULTI_LINK_LABEL in self.issue_package.labels_name:
self.bot_advice.append('multi readme link!')
+ def inconsistent_tag_policy(self):
+ if INCONSISTENT_TAG in self.issue_package.labels_name:
+ self.bot_advice.append('Attention to inconsistent tag')
+
def remind_logic(self) -> bool:
return abs(self.date_from_target) <= 2
@@ -268,6 +274,7 @@ def auto_bot_advice(self):
self.new_comment_policy()
self.multi_link_policy()
self.date_remind_policy()
+ self.inconsistent_tag_policy()
def get_target_date(self):
body = self.get_issue_body()
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 99f381367b2a..55f02daad100 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -16,8 +16,7 @@
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
_BRANCH_ATTENTION = 'base-branch-attention'
_7_DAY_ATTENTION = '7days attention'
-_MULTI_API = 'MultiAPI'
-_INCONSISTENT_TAG = 'Inconsistent tag'
+_MultiAPI = 'MultiAPI'
# record published issues
_FILE_OUT = 'published_issues_python.csv'
@@ -49,17 +48,11 @@ def init_readme_link(self) -> None:
# get readme_link
self.get_readme_link(origin_link)
- def check_tag_consistency(self) -> None:
- self.target_readme_tag = self.target_readme_tag.replace('tag-', '')
- super().check_tag_consistency()
- if self.default_readme_tag != self.target_readme_tag:
- self.add_label(_INCONSISTENT_TAG)
-
def multi_api_policy(self) -> None:
if self.is_multiapi:
self.bot_advice.append('MultiAPI')
- if _MULTI_API not in self.issue_package.labels_name:
- self.add_label(_MULTI_API)
+ if _MultiAPI not in self.issue_package.labels_name:
+ self.add_label(_MultiAPI)
def get_package_and_output(self) -> None:
self.init_readme_link()
@@ -69,7 +62,7 @@ def get_package_and_output(self) -> None:
pattern_output = re.compile(r'\$\(python-sdks-folder\)/(.*?)/azure-')
self.package_name = pattern_package.search(contents).group().split(':')[-1].strip()
self.output_folder = pattern_output.search(contents).group().split('/')[1]
- self.is_multiapi = (_MULTI_API in self.issue_package.labels_name) or ('multi-api' in contents)
+ self.is_multiapi = (_MultiAPI in self.issue_package.labels_name) or ('multi-api' in contents)
def get_edit_content(self) -> None:
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}' \
@@ -116,9 +109,6 @@ def attention_policy(self):
if _BRANCH_ATTENTION in self.issue_package.labels_name:
self.bot_advice.append('new version is 0.0.0, please check base branch!')
- if _INCONSISTENT_TAG in self.issue_package.labels_name:
- self.bot_advice.append('Attention to inconsistent tag')
-
def remind_policy(self):
if self.delay_time >= 15 and _7_DAY_ATTENTION in self.issue_package.labels_name and self.date_from_target < 0:
self.comment(
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index a26d4c1fbe51..4c3172310a4c 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -18,6 +18,7 @@
AUTO_PARSE_LABEL = 'auto-link'
AUTO_CLOSE_LABEL = 'auto-close'
MULTI_LINK_LABEL = 'MultiLink'
+INCONSISTENT_TAG = 'Inconsistent tag'
_LOG = logging.getLogger(__name__)
From a71985649c165a2ea5eadee6d82d84b0ab0f866d Mon Sep 17 00:00:00 2001
From: BigCat20196 <1095260342@qq.com>
Date: Tue, 12 Jul 2022 10:36:49 +0800
Subject: [PATCH 103/103] update multiapi policy
---
scripts/release_helper/python.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/python.py b/scripts/release_helper/python.py
index 55f02daad100..f444063ed165 100644
--- a/scripts/release_helper/python.py
+++ b/scripts/release_helper/python.py
@@ -50,7 +50,8 @@ def init_readme_link(self) -> None:
def multi_api_policy(self) -> None:
if self.is_multiapi:
- self.bot_advice.append('MultiAPI')
+ if _AUTO_ASK_FOR_CHECK not in self.issue_package.labels_name:
+ self.bot_advice.append(_MultiAPI)
if _MultiAPI not in self.issue_package.labels_name:
self.add_label(_MultiAPI)