From a4c664586cabd51a79a991e6c80b9af21a1f702a Mon Sep 17 00:00:00 2001
From: msyyc <70930885+msyyc@users.noreply.github.com>
Date: Fri, 26 Nov 2021 15:00:25 +0800
Subject: [PATCH 01/21] update for Go
---
scripts/release_helper/go.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index 190fc007d81b..0405cd053be3 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -6,7 +6,7 @@
_GO_OWNER = {'ArcturusZhang'}
# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_GO = {'ArcturusZhang': os.getenv('PYTHON_ZED_TOKEN')}
+_ASSIGNEE_TOKEN_GO = {'ArcturusZhang': os.getenv('GO_DAPENGZHANG_TOKEN')}
class IssueProcessGo(IssueProcess):
From d96f9e1f5df1f4a31abb193b61aff7a6ca84818a Mon Sep 17 00:00:00 2001
From: msyyc <70930885+msyyc@users.noreply.github.com>
Date: Fri, 26 Nov 2021 17:23:25 +0800
Subject: [PATCH 02/21] check tag consistency and optize reply
---
scripts/release_helper/common.py | 59 ++++++++++++++++++--------------
scripts/release_helper/java.py | 17 ++++++++-
scripts/release_helper/main.py | 3 +-
scripts/release_helper/utils.py | 4 +--
4 files changed, 53 insertions(+), 30 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 4f813b359370..101857f4c847 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -16,17 +16,20 @@
_ASSIGNEE_TOKEN = {'msyyc': os.getenv('PYTHON_MSYYC_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'
+
class IssueProcess:
# won't be changed anymore after __init__
request_repo_dict = {} # request repo instance generated by different token
owner = '' # issue owner
assignee_candidates = {} # assignee candidates who will be assigned to handle issue
- language_owner = {} # language owner who may handle issue
+ language_owner = {} # language owner who may handle issue
# will be changed by order
issue = None # issue that needs to handle
assignee = ''
- bot = '' # bot advice to help SDK owner
+ bot = [] # bot advice to help SDK owner
target_readme_tag = '' # swagger content that customers want
readme_link = '' # https link which swagger definition is in
default_readme_tag = '' # configured in `README.md`
@@ -55,33 +58,35 @@ 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("https://github.com/Azure/azure-rest-api-specs/pull/", "").strip('/'))
+ pr_number = int(link.replace(f"{_SWAGGER_PULL}/", "").strip('/'))
# Get Readme link
pr_info = self.issue_package.rest_repo.get_pull(number=pr_number)
pk_url_name = set()
for pr_changed_file in pr_info.get_files():
contents_url = pr_changed_file.contents_url
- if '/resource-manager' in contents_url:
- try:
- pk_url_name.add(re.findall(r'/specification/(.*?)/resource-manager/', contents_url)[0])
- except Exception as e:
- continue
- if len(pk_url_name) > 1:
- message = f"{pk_url_name} contains multiple packages "
- self.log(message)
- self.comment(
- f'Hi, @{self.assignee}, "{link}" contains multi packages, please extract readme link manually.')
- raise Exception(message)
-
- readme_link = f'https://github.com/Azure/azure-rest-api-specs/blob/main/specification/' \
- f'{pk_url_name.pop()}/resource-manager'
- return readme_link
+ if '/resource-manager' not in contents_url:
+ continue
+ try:
+ pk_url_name.add(re.findall(r'/specification/(.*?)/resource-manager/', contents_url)[0])
+ except Exception as e:
+ continue
+ readme_link = [f'{_SWAGGER_URL}/{item}/resource-manager' for item in pk_url_name]
+ if len(readme_link) > 1:
+ multi_link = ', '.join(readme_link)
+ pr = f"{_SWAGGER_PULL}/{pr_number}"
+ self.comment(f'Hi, @{self.assignee}, by parsing {pr}, there are multi service link: {multi_link}. Please decide which one is the right.')
+ self.bot.append('multi readme link!')
+ raise Exception(f'multi link in "{pr}"')
+
+ return readme_link[0]
def get_readme_link(self, origin_link: str):
# check whether link is valid
if 'azure-rest-api-specs' not in origin_link:
- self.comment(f'Hi, @{self.owner}, "{origin_link}" is not valid link. Please provide valid link like '
+ self.comment(f'Hi, @{self.owner}, "{origin_link}" is not valid link. Please follow [doc]'
+ f'(https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/release-request/'
+ f'rules-for-release-request.md#2-link-to-pr-or-spec-if-pr-unavailable) to provide valid link like '
f'"https://github.com/Azure/azure-rest-api-specs/pull/16750" or '
f'"https://github.com/Azure/azure-rest-api-specs/tree/main/'
f'specification/network/resource-manager"')
@@ -128,9 +133,11 @@ def edit_issue_body(self) -> None:
def check_tag_consistency(self) -> None:
if self.default_readme_tag != self.target_readme_tag:
- self.comment(f'Hi, @{self.owner}, your **Readme Tag** is `{self.target_readme_tag}`, '
- f'but in [readme.md]({self.readme_link}) it is still `{self.default_readme_tag}`, '
- f'please modify the readme.md or your **Readme Tag** above ')
+ 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) '
+ f'it is still `{self.default_readme_tag}`, please modify the readme.md or your '
+ f'**Readme Tag** above ')
def auto_parse(self) -> None:
if AUTO_PARSE_LABEL in self.issue_package.labels_name:
@@ -146,9 +153,9 @@ def auto_parse(self) -> None:
self.get_readme_link(origin_link)
# get default tag with readme_link
- # self.get_default_readme_tag()
+ self.get_default_readme_tag()
- # self.check_tag_consistency()
+ self.check_tag_consistency()
self.edit_issue_body()
@@ -200,7 +207,7 @@ class Common:
issues_package = None # issues that need to handle
request_repo_dict = {} # request repo instance generated by different token
assignee_candidates = {} # assignee candidates who will be assigned to handle issue
- language_owner = {} # language owner who may handle issue
+ language_owner = {} # language owner who may handle issue
def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], language_owner: Set[str]):
self.issues_package = issues
@@ -215,7 +222,7 @@ def run(self):
try:
issue.run()
except Exception as e:
- _LOG.error(f'Error happened during handling issue {item.issue_package.issue.number}: {e}')
+ _LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
def common_process(issues: List[IssuePackage]):
diff --git a/scripts/release_helper/java.py b/scripts/release_helper/java.py
index 810c81be11e9..32d0185e63dc 100644
--- a/scripts/release_helper/java.py
+++ b/scripts/release_helper/java.py
@@ -1,4 +1,5 @@
from common import IssueProcess, Common
+from utils import AUTO_PARSE_LABEL, get_origin_link_and_tag
from typing import Any, List
import os
@@ -14,7 +15,21 @@
class IssueProcessJava(IssueProcess):
- pass
+
+ def auto_parse(self) -> None:
+ if AUTO_PARSE_LABEL in self.issue_package.labels_name:
+ return
+
+ self.add_label(AUTO_PARSE_LABEL)
+ 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)
+
+ self.edit_issue_body()
class Java(Common):
diff --git a/scripts/release_helper/main.py b/scripts/release_helper/main.py
index cfdc4db86859..5ee6e579622f 100644
--- a/scripts/release_helper/main.py
+++ b/scripts/release_helper/main.py
@@ -5,6 +5,7 @@
from go import go_process
from java import java_process
from js import js_process
+from common import common_process
import os
from typing import List
@@ -22,7 +23,7 @@
't': 'Test'
}
_LANGUAGES = {
- 'Test': python_process,
+ 'Test': common_process,
# 'Python': python_process,
'Java': java_process,
'Go': go_process,
diff --git a/scripts/release_helper/utils.py b/scripts/release_helper/utils.py
index 49e036fce502..5cbb80341213 100644
--- a/scripts/release_helper/utils.py
+++ b/scripts/release_helper/utils.py
@@ -14,9 +14,9 @@
def get_origin_link_and_tag(issue_body_list: List[str]) -> (str, str):
link, readme_tag = '', ''
for row in issue_body_list:
- if 'link' in row.lower():
+ if 'link' in row.lower() and link == '':
link = row.split(":", 1)[-1].strip()
- if 'readme tag' in row.lower():
+ if 'readme tag' in row.lower() and readme_tag == '':
readme_tag = row.split(":", 1)[-1].strip()
if link and readme_tag:
break
From 29dcc3b74f66aaea9a48f2be4c0997ee52037425 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Tue, 30 Nov 2021 17:08:06 +0800
Subject: [PATCH 03/21] add write.md
---
scripts/release_helper/common.py | 38 ++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 101857f4c847..dd5d1505f366 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -1,3 +1,4 @@
+from datetime import date, datetime
from typing import Set, List, Dict
import os
from utils import IssuePackage, REQUEST_REPO, AUTO_ASSIGN_LABEL, AUTO_PARSE_LABEL, get_origin_link_and_tag
@@ -15,10 +16,10 @@
# 'github assignee': 'token'
_ASSIGNEE_TOKEN = {'msyyc': os.getenv('PYTHON_MSYYC_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'
+
class IssueProcess:
# won't be changed anymore after __init__
request_repo_dict = {} # request repo instance generated by different token
@@ -75,7 +76,8 @@ def get_readme_from_pr_link(self, link: str) -> str:
if len(readme_link) > 1:
multi_link = ', '.join(readme_link)
pr = f"{_SWAGGER_PULL}/{pr_number}"
- self.comment(f'Hi, @{self.assignee}, by parsing {pr}, there are multi service link: {multi_link}. Please decide which one is the right.')
+ self.comment(
+ f'Hi, @{self.assignee}, by parsing {pr}, there are multi service link: {multi_link}. Please decide which one is the right.')
self.bot.append('multi readme link!')
raise Exception(f'multi link in "{pr}"')
@@ -213,16 +215,48 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
self.issues_package = issues
self.assignee_candidates = set(assignee_token.keys())
self.language_owner = language_owner
+ # arguments add to language.md
+ self.file_out_name = 'common.md'
+ self.bot_advice = ''
+ self.target_release_date = ''
+ self.date_from_target = ''
+ self.package_name = ''
+
for assignee in assignee_token:
self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
+ def output_python_md(self, items):
+ 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')
+ file_out.writelines([self.output_python(item) for item in items])
+
+ def output_python(self, item):
+ create_date = str(date.fromtimestamp(item.created_at.timestamp()).strftime('%m-%d'))
+
+ return '| [#{}]({}) | {} | {} | {} | {} | {} | {} | {} |\n'.format(
+ item.issue_package.issue.html_url.split('/')[-1],
+ item.issue_package.issue.html_url,
+ item.user.login,
+ self.package_name,
+ item.assignee.login,
+ self.bot_advice,
+ create_date,
+ self.target_release_date,
+ self.date_from_target
+ )
+
def run(self):
+ items = []
for item in self.issues_package:
issue = IssueProcess(item, self.request_repo_dict, self.assignee_candidates, self.language_owner)
try:
issue.run()
+ items.append(issue)
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
+ self.output_python_md(items)
def common_process(issues: List[IssuePackage]):
From 7c41af8849ba8cbe8e5f67968d46c4f198d621f4 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Tue, 30 Nov 2021 17:14:35 +0800
Subject: [PATCH 04/21] update go js readme
---
scripts/release_helper/go.py | 4 +++-
scripts/release_helper/js.py | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index 0405cd053be3..5d17ddf56ecf 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -14,7 +14,9 @@ class IssueProcessGo(IssueProcess):
class Go(Common):
- pass
+ def __init__(self):
+ super(Go, self).__init__()
+ self.file_out_name = 'release_go_status.md'
def go_process(issues: List[Any]):
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index 4bdd596986e9..9139d8adce73 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -14,7 +14,9 @@ class IssueProcessJs(IssueProcess):
class Js(Common):
- pass
+ def __init__(self):
+ super(Js, self).__init__()
+ self.file_out_name = 'release_js_status.md'
def js_process(issues: List[Any]):
From bdeabc39b23d7ed6bb0e0ea4573d85e139c49709 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Tue, 30 Nov 2021 17:43:29 +0800
Subject: [PATCH 05/21] update
---
scripts/release_helper/common.py | 6 ++++++
scripts/release_helper/go.py | 4 ++--
scripts/release_helper/js.py | 4 ++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index dd5d1505f366..e9c3c1db54eb 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -7,6 +7,7 @@
import time
from github import Github
from github.Repository import Repository
+import subprocess as sp
_LOG = logging.getLogger(__name__)
@@ -247,6 +248,10 @@ def output_python(self, item):
self.date_from_target
)
+ def push_md_to_storage(self):
+ cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
+ [sp.check_call(cmd, shell=True) for cmd in cmd_list]
+
def run(self):
items = []
for item in self.issues_package:
@@ -257,6 +262,7 @@ def run(self):
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
self.output_python_md(items)
+ self.push_md_to_storage()
def common_process(issues: List[IssuePackage]):
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index 5d17ddf56ecf..61464dd1c681 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -14,8 +14,8 @@ class IssueProcessGo(IssueProcess):
class Go(Common):
- def __init__(self):
- super(Go, self).__init__()
+ def __init__(self, issues, assignee_token, language_owner):
+ super(Go, self).__init__(issues, assignee_token, language_owner)
self.file_out_name = 'release_go_status.md'
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index 9139d8adce73..4792a38336fd 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -14,8 +14,8 @@ class IssueProcessJs(IssueProcess):
class Js(Common):
- def __init__(self):
- super(Js, self).__init__()
+ def __init__(self, issues, assignee_token, language_owner):
+ super(Js, self).__init__(issues, assignee_token, language_owner)
self.file_out_name = 'release_js_status.md'
From c0ab72fc522d46d1c71d5c7cff3ea6c206f0369b Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Tue, 30 Nov 2021 17:51:56 +0800
Subject: [PATCH 06/21] Update common.py
---
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 e9c3c1db54eb..84c0aafddd99 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -234,7 +234,7 @@ def output_python_md(self, items):
file_out.writelines([self.output_python(item) for item in items])
def output_python(self, item):
- create_date = str(date.fromtimestamp(item.created_at.timestamp()).strftime('%m-%d'))
+ create_date = str(date.fromtimestamp(item.issue_package.issue.created_at.timestamp()).strftime('%m-%d'))
return '| [#{}]({}) | {} | {} | {} | {} | {} | {} | {} |\n'.format(
item.issue_package.issue.html_url.split('/')[-1],
From ba7d78589a0c87c59c7f7586cc490b0021ce1b78 Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 10:03:17 +0800
Subject: [PATCH 07/21] Update common.py
---
scripts/release_helper/common.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 84c0aafddd99..1b290f982926 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -239,9 +239,9 @@ def output_python(self, item):
return '| [#{}]({}) | {} | {} | {} | {} | {} | {} | {} |\n'.format(
item.issue_package.issue.html_url.split('/')[-1],
item.issue_package.issue.html_url,
- item.user.login,
+ item.issue_package.issue.user.login,
self.package_name,
- item.assignee.login,
+ item.issue_package.issue.assignee.login,
self.bot_advice,
create_date,
self.target_release_date,
From 6231625ba1a662e698acab1cb98574e4ea3705f1 Mon Sep 17 00:00:00 2001
From: msyyc <70930885+msyyc@users.noreply.github.com>
Date: Wed, 1 Dec 2021 13:16:41 +0800
Subject: [PATCH 08/21] update assignee for JS
---
scripts/release_helper/js.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index 4bdd596986e9..e2515070cb44 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -3,10 +3,10 @@
import os
# assignee dict which will be assigned to handle issues
-_JS_OWNER = {'lirenhe'}
+_JS_OWNER = {'qiaozha', 'lirenhe'}
# 'github assignee': 'token'
-_ASSIGNEE_TOKEN_JS = {'lirenhe': os.getenv('JS_QIAOQIAO_TOKEN')}
+_ASSIGNEE_TOKEN_JS = {'qiaozha': os.getenv('JS_QIAOQIAO_TOKEN')}
class IssueProcessJs(IssueProcess):
From 41190c6d7c2df2066b8bb749ec0f2761c277411b Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Wed, 1 Dec 2021 14:26:10 +0800
Subject: [PATCH 09/21] update
---
scripts/release_helper/common.py | 7 +++----
scripts/release_helper/release_helper.yml | 4 ++--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 1b290f982926..44333640e864 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -218,7 +218,6 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
self.language_owner = language_owner
# arguments add to language.md
self.file_out_name = 'common.md'
- self.bot_advice = ''
self.target_release_date = ''
self.date_from_target = ''
self.package_name = ''
@@ -226,7 +225,7 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
for assignee in assignee_token:
self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
- def output_python_md(self, items):
+ def output_md(self, items):
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')
@@ -242,7 +241,7 @@ def output_python(self, item):
item.issue_package.issue.user.login,
self.package_name,
item.issue_package.issue.assignee.login,
- self.bot_advice,
+ item.bot,
create_date,
self.target_release_date,
self.date_from_target
@@ -261,7 +260,7 @@ def run(self):
items.append(issue)
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
- self.output_python_md(items)
+ self.output_md(items)
self.push_md_to_storage()
diff --git a/scripts/release_helper/release_helper.yml b/scripts/release_helper/release_helper.yml
index 2f6bbc31a499..3307b787837b 100644
--- a/scripts/release_helper/release_helper.yml
+++ b/scripts/release_helper/release_helper.yml
@@ -55,8 +55,8 @@ jobs:
pip install -r $script_path/requirement.txt
# checkout the target branch
- # cd file-storage
- # git checkout release-helper
+ cd file-storage
+ git checkout release-helper
# run
python $script_path/main.py
From d5ca1dc6edfa9dca14dc4880a28561bdbb16207e Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Wed, 1 Dec 2021 14:49:10 +0800
Subject: [PATCH 10/21] update
---
scripts/release_helper/common.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 44333640e864..b32f9c048ab2 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -248,9 +248,19 @@ def output_python(self, item):
)
def push_md_to_storage(self):
+ with open('release_go_status.md','r') as f :
+ print(f.read())
cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
[sp.check_call(cmd, shell=True) for cmd in cmd_list]
+ def traversal_files(self,path):
+ for dir in os.listdir(path):
+ dir = os.path.join(path, dir)
+ print(dir)
+ # 判断当前目录是否为文件夹
+ if os.path.isdir(dir):
+ self.traversal_files(dir)
+
def run(self):
items = []
for item in self.issues_package:
From 7110dbbe6cdb1645851c4091bcdfbe5346152682 Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 14:59:18 +0800
Subject: [PATCH 11/21] Update common.py
---
scripts/release_helper/common.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index b32f9c048ab2..a5704f6fc226 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -249,14 +249,14 @@ def output_python(self, item):
def push_md_to_storage(self):
with open('release_go_status.md','r') as f :
- print(f.read())
+ print(f.read(),'++++++++++++++++++')
cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
[sp.check_call(cmd, shell=True) for cmd in cmd_list]
def traversal_files(self,path):
for dir in os.listdir(path):
dir = os.path.join(path, dir)
- print(dir)
+ print(dir,'+++++++++++++++++++++++')
# 判断当前目录是否为文件夹
if os.path.isdir(dir):
self.traversal_files(dir)
@@ -271,6 +271,7 @@ def run(self):
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
self.output_md(items)
+ self.traversal_files('.')
self.push_md_to_storage()
From 32bc8ef1808d3d5b08d25c8b671ab3da88ab290a Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 15:15:35 +0800
Subject: [PATCH 12/21] Update common.py
---
scripts/release_helper/common.py | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index a5704f6fc226..568a613ec5b3 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -253,14 +253,6 @@ def push_md_to_storage(self):
cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
[sp.check_call(cmd, shell=True) for cmd in cmd_list]
- def traversal_files(self,path):
- for dir in os.listdir(path):
- dir = os.path.join(path, dir)
- print(dir,'+++++++++++++++++++++++')
- # 判断当前目录是否为文件夹
- if os.path.isdir(dir):
- self.traversal_files(dir)
-
def run(self):
items = []
for item in self.issues_package:
@@ -271,7 +263,7 @@ def run(self):
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
self.output_md(items)
- self.traversal_files('.')
+ print(os.listdir('.'),os.getcwd(),'+++++++++++')
self.push_md_to_storage()
From e76d3ab489d4fa2bc0c80a145404d12356a6f845 Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 15:37:13 +0800
Subject: [PATCH 13/21] Update release_helper.yml for Azure Pipelines
---
scripts/release_helper/release_helper.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/release_helper/release_helper.yml b/scripts/release_helper/release_helper.yml
index 3307b787837b..9023f73a5785 100644
--- a/scripts/release_helper/release_helper.yml
+++ b/scripts/release_helper/release_helper.yml
@@ -36,8 +36,8 @@ jobs:
git config --global user.name "ReleaseHelper"
# clone(REPO: https://github.com/Azure/azure-sdk-for-python.git, USR_NAME: Azure, USR_TOKEN: xxxxxxxxxxxxx)
- # mkdir file-storage
- # git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage
+ mkdir file-storage
+ git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage
# import env variable
export TOKEN=$(Yuchao-GitToken)
From 5c4b1395de0aa52d317403e2a1189c375ad0e0b2 Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 15:49:09 +0800
Subject: [PATCH 14/21] Update common.py
---
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 568a613ec5b3..678351f168d3 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -248,7 +248,7 @@ def output_python(self, item):
)
def push_md_to_storage(self):
- with open('release_go_status.md','r') as f :
+ with open('release_js_status.md','r') as f :
print(f.read(),'++++++++++++++++++')
cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
[sp.check_call(cmd, shell=True) for cmd in cmd_list]
From 9230cc8397ee78faf9648cf4a07ff82e5c6b41a8 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Wed, 1 Dec 2021 16:26:29 +0800
Subject: [PATCH 15/21] update
---
scripts/release_helper/common.py | 8 +++-----
scripts/release_helper/main.py | 3 ++-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 568a613ec5b3..8eafca8b1817 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -247,9 +247,8 @@ def output_python(self, item):
self.date_from_target
)
- def push_md_to_storage(self):
- with open('release_go_status.md','r') as f :
- print(f.read(),'++++++++++++++++++')
+ @staticmethod
+ def push_md_to_storage():
cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
[sp.check_call(cmd, shell=True) for cmd in cmd_list]
@@ -263,8 +262,7 @@ def run(self):
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
self.output_md(items)
- print(os.listdir('.'),os.getcwd(),'+++++++++++')
- self.push_md_to_storage()
+
def common_process(issues: List[IssuePackage]):
diff --git a/scripts/release_helper/main.py b/scripts/release_helper/main.py
index 5ee6e579622f..3e3ac080187d 100644
--- a/scripts/release_helper/main.py
+++ b/scripts/release_helper/main.py
@@ -5,7 +5,7 @@
from go import go_process
from java import java_process
from js import js_process
-from common import common_process
+from common import common_process, Common
import os
from typing import List
@@ -54,6 +54,7 @@ def main():
for language in languages:
language_issues = select_language_issues(issues, language)
languages[language](language_issues)
+ Common.push_md_to_storage()
if __name__ == '__main__':
From 0708059a492d45f0d8e8699e9f2c2dea3ee75906 Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 16:41:06 +0800
Subject: [PATCH 16/21] Update common.py
---
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 8eafca8b1817..5351ece5bd62 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -225,7 +225,8 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
for assignee in assignee_token:
self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
- def output_md(self, items):
+ def output_md(self, items):
+ print('++++file out name',self.file_out_name)
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')
From 3ae973996df5c0077f9d67ed31d53eceafc3729f Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 17:10:36 +0800
Subject: [PATCH 17/21] Update common.py
---
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 5351ece5bd62..19bc987581bb 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -254,6 +254,7 @@ def push_md_to_storage():
[sp.check_call(cmd, shell=True) for cmd in cmd_list]
def run(self):
+ print(self.file_out_name,'77777777777777')
items = []
for item in self.issues_package:
issue = IssueProcess(item, self.request_repo_dict, self.assignee_candidates, self.language_owner)
From 4726a3047595420af2118428096f1599d0697b05 Mon Sep 17 00:00:00 2001
From: Yiming Lei <59104634+RAY-316@users.noreply.github.com>
Date: Wed, 1 Dec 2021 17:28:33 +0800
Subject: [PATCH 18/21] Update main.py
---
scripts/release_helper/main.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/release_helper/main.py b/scripts/release_helper/main.py
index 3e3ac080187d..f6ba3eda3435 100644
--- a/scripts/release_helper/main.py
+++ b/scripts/release_helper/main.py
@@ -51,6 +51,7 @@ def main():
issues = collect_open_issues()
language = os.getenv('LANGUAGE')
languages = {_CONVERT[language]: _LANGUAGES[_CONVERT[language]]} if language in _CONVERT else _LANGUAGES
+ print(languages,'++++++++++')
for language in languages:
language_issues = select_language_issues(issues, language)
languages[language](language_issues)
From 910e856d7cd66a86573edb89dc9ab199064a86c6 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Thu, 2 Dec 2021 10:38:22 +0800
Subject: [PATCH 19/21] update
---
scripts/release_helper/common.py | 1 +
scripts/release_helper/java.py | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 8eafca8b1817..bdea823443f3 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -226,6 +226,7 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
def output_md(self, items):
+ print('++++file out name',self.file_out_name)
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')
diff --git a/scripts/release_helper/java.py b/scripts/release_helper/java.py
index 32d0185e63dc..69fddae8b06c 100644
--- a/scripts/release_helper/java.py
+++ b/scripts/release_helper/java.py
@@ -33,7 +33,9 @@ def auto_parse(self) -> None:
class Java(Common):
- pass
+ def __init__(self, issues, assignee_token, language_owner):
+ super(Java, self).__init__(issues, assignee_token, language_owner)
+ self.file_out_name = 'release_java_status.md'
def java_process(issues: List[Any]):
From 6053c72b6836d1298be88fd0037661b593ec72f3 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Thu, 2 Dec 2021 16:01:57 +0800
Subject: [PATCH 20/21] update bot advice
---
scripts/release_helper/common.py | 17 ++++++++++++++---
scripts/release_helper/java.py | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index bdea823443f3..bb62d726e9c0 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -31,7 +31,7 @@ class IssueProcess:
# will be changed by order
issue = None # issue that needs to handle
assignee = ''
- bot = [] # bot advice to help SDK owner
+ bot = '' # bot advice to help SDK owner
target_readme_tag = '' # swagger content that customers want
readme_link = '' # https link which swagger definition is in
default_readme_tag = '' # configured in `README.md`
@@ -199,10 +199,23 @@ def auto_assign(self) -> None:
self.update_issue_instance()
self.add_label(AUTO_ASSIGN_LABEL)
+ def bot_advice(self):
+ latest_comments = ''
+ comments = [(comment.updated_at.timestamp(), comment.user.login) for comment in
+ self.issue_package.issue.get_comments()]
+ comments.sort()
+ if comments:
+ latest_comments = comments[-1][1]
+ if self.issue_package.issue.comments == 0:
+ self.bot = 'new issue !
'
+ elif latest_comments not in self.language_owner:
+ self.bot = 'new comment.
'
+
def run(self) -> None:
# common part(don't change the order)
self.auto_assign() # necessary flow
self.auto_parse() # necessary flow
+ self.bot_advice()
class Common:
@@ -226,7 +239,6 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
def output_md(self, items):
- print('++++file out name',self.file_out_name)
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')
@@ -265,7 +277,6 @@ def run(self):
self.output_md(items)
-
def common_process(issues: List[IssuePackage]):
instance = Common(issues, _ASSIGNEE_TOKEN, _LANGUAGE_OWNER)
instance.run()
diff --git a/scripts/release_helper/java.py b/scripts/release_helper/java.py
index 69fddae8b06c..d83e87ee1ae8 100644
--- a/scripts/release_helper/java.py
+++ b/scripts/release_helper/java.py
@@ -38,6 +38,7 @@ def __init__(self, issues, assignee_token, 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.run()
From be9e9bcdff544da9e9edd41cce60db1335778210 Mon Sep 17 00:00:00 2001
From: Zed <601306339@qq.com>
Date: Thu, 2 Dec 2021 16:04:09 +0800
Subject: [PATCH 21/21] update
---
scripts/release_helper/main.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/release_helper/main.py b/scripts/release_helper/main.py
index f6ba3eda3435..3e3ac080187d 100644
--- a/scripts/release_helper/main.py
+++ b/scripts/release_helper/main.py
@@ -51,7 +51,6 @@ def main():
issues = collect_open_issues()
language = os.getenv('LANGUAGE')
languages = {_CONVERT[language]: _LANGUAGES[_CONVERT[language]]} if language in _CONVERT else _LANGUAGES
- print(languages,'++++++++++')
for language in languages:
language_issues = select_language_issues(issues, language)
languages[language](language_issues)