Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Script] Release helper #25122

Merged
merged 120 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
a4c6645
update for Go
msyyc Nov 26, 2021
d96f9e1
check tag consistency and optize reply
msyyc Nov 26, 2021
29dcc3b
add write.md
RAY-316 Nov 30, 2021
7c41af8
update go js readme
RAY-316 Nov 30, 2021
971b310
Merge pull request #27 from msyyc/helper-update-1
RAY-316 Nov 30, 2021
bdeabc3
update
RAY-316 Nov 30, 2021
3d466ae
Merge pull request #28 from msyyc/helper-update-1
RAY-316 Nov 30, 2021
c0ab72f
Update common.py
RAY-316 Nov 30, 2021
ba7d785
Update common.py
RAY-316 Dec 1, 2021
6231625
update assignee for JS
msyyc Dec 1, 2021
41190c6
update
RAY-316 Dec 1, 2021
46c273e
Merge pull request #29 from RAY-316/helper-update-2
RAY-316 Dec 1, 2021
d5ca1dc
update
RAY-316 Dec 1, 2021
8a44300
Merge pull request #30 from RAY-316/helper-update-2
RAY-316 Dec 1, 2021
7110dbb
Update common.py
RAY-316 Dec 1, 2021
32bc8ef
Update common.py
RAY-316 Dec 1, 2021
e76d3ab
Update release_helper.yml for Azure Pipelines
RAY-316 Dec 1, 2021
5c4b139
Update common.py
RAY-316 Dec 1, 2021
9230cc8
update
RAY-316 Dec 1, 2021
65cd109
Merge branch 'release-helper' into helper-update-2
RAY-316 Dec 1, 2021
e901ee2
Merge pull request #31 from RAY-316/helper-update-2
RAY-316 Dec 1, 2021
0708059
Update common.py
RAY-316 Dec 1, 2021
3ae9739
Update common.py
RAY-316 Dec 1, 2021
4726a30
Update main.py
RAY-316 Dec 1, 2021
910e856
update
RAY-316 Dec 2, 2021
a97639a
Merge branch 'release-helper' into helper-update-2
RAY-316 Dec 2, 2021
6053c72
update bot advice
RAY-316 Dec 2, 2021
672f312
Merge branch 'helper-update-2' of https://github.com/msyyc/azure-sdk-…
RAY-316 Dec 2, 2021
be9e9bc
update
RAY-316 Dec 2, 2021
eb3875e
update
msyyc Dec 15, 2021
cbba97b
update excel
msyyc Dec 15, 2021
578d349
update output function
msyyc Dec 16, 2021
9648164
add exception handle for bad credential
msyyc Dec 16, 2021
cd06868
fix static varaible in class
msyyc Dec 16, 2021
9a79019
update auto_assignee algorithm
msyyc Dec 16, 2021
6b6c7de
merge main
msyyc Dec 16, 2021
baaa568
update bot token to have a try
msyyc Dec 22, 2021
2f8b301
update bot token
msyyc Dec 22, 2021
c914ef8
force to single process
msyyc Dec 22, 2021
04f1cab
test
BigCat20196 Mar 17, 2022
50a757d
test
BigCat20196 Mar 17, 2022
27dca4f
test
BigCat20196 Mar 17, 2022
ec25604
Merge branch 'main' into release-helper
BigCat20196 Mar 17, 2022
11afaaa
test
BigCat20196 Mar 17, 2022
6ad173c
Merge branch 'release-helper' of https://github.com/msyyc/azure-sdk-f…
BigCat20196 Mar 17, 2022
1b4959d
fix bug
BigCat20196 Mar 17, 2022
032ac00
fix
BigCat20196 Mar 17, 2022
f407d8b
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Mar 29, 2022
08c51a0
update release_helper/js
BigCat20196 Mar 29, 2022
b854175
update release_helper/js
BigCat20196 Mar 29, 2022
3db56d9
fix bug
BigCat20196 Mar 29, 2022
a5f2697
update release helper
BigCat20196 Mar 30, 2022
59ca186
Update js.py
BigCat20196 Mar 30, 2022
f3f66c2
Update js.py
BigCat20196 Mar 30, 2022
1a79e89
Update js.py
msyyc Mar 30, 2022
663250d
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Apr 8, 2022
3cadc34
urldecode
BigCat20196 Apr 8, 2022
7fe5dda
format
BigCat20196 Apr 8, 2022
495c673
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jun 9, 2022
1d7b492
add python
BigCat20196 Jun 9, 2022
1a7ea45
fix
BigCat20196 Jun 9, 2022
38c743b
add package name
BigCat20196 Jun 9, 2022
fbd6688
update package name
BigCat20196 Jun 9, 2022
80176c7
update package name
BigCat20196 Jun 9, 2022
751f1d9
fix bug
BigCat20196 Jun 9, 2022
fba6456
update get edit_content
BigCat20196 Jun 10, 2022
e4dcb02
auto-close
BigCat20196 Jun 10, 2022
98acf92
record release
BigCat20196 Jun 13, 2022
59a156b
debug
BigCat20196 Jun 13, 2022
d7f4fca
debug
BigCat20196 Jun 13, 2022
c338d58
debug
BigCat20196 Jun 13, 2022
7d04c42
override run
BigCat20196 Jun 13, 2022
195d661
init readme link
BigCat20196 Jun 13, 2022
b182787
fix
BigCat20196 Jun 13, 2022
0596363
fix
BigCat20196 Jun 13, 2022
7b11ace
fix
BigCat20196 Jun 13, 2022
373c12b
update assignee_token and auto-close
BigCat20196 Jun 20, 2022
7a32e05
fix
BigCat20196 Jun 20, 2022
4cacd5f
debug
BigCat20196 Jun 21, 2022
081e2ad
fix
BigCat20196 Jun 21, 2022
b07eb2e
auto-reply
BigCat20196 Jun 21, 2022
f8e4719
fix
BigCat20196 Jun 21, 2022
aef1947
debug
BigCat20196 Jun 21, 2022
b0b63ef
fix
BigCat20196 Jun 21, 2022
d1d4799
debug
BigCat20196 Jun 22, 2022
d74825f
debug
BigCat20196 Jun 22, 2022
a8f4308
fix
BigCat20196 Jun 22, 2022
87f2ebe
debugg
BigCat20196 Jun 22, 2022
4fce70c
update yaml
BigCat20196 Jun 23, 2022
b01e55d
change to add_label
BigCat20196 Jun 23, 2022
9d18dfe
format
BigCat20196 Jun 23, 2022
2f28e57
add attention policy and remind policy
BigCat20196 Jun 24, 2022
bb06dfd
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jun 24, 2022
85330b5
add duplicated policy
BigCat20196 Jun 27, 2022
65e5deb
delete uesless code
BigCat20196 Jun 27, 2022
788a451
Update scripts/release_helper/utils.py
BigCat20196 Jun 28, 2022
d1fc233
update
BigCat20196 Jun 28, 2022
7e2ddb5
fix dependence version
BigCat20196 Jun 28, 2022
388b373
fix dependence version
BigCat20196 Jun 28, 2022
b7eb450
fix env
BigCat20196 Jun 28, 2022
2ee48d1
update js assignee
BigCat20196 Jun 28, 2022
07509ad
update js assignee
BigCat20196 Jun 28, 2022
1d5f58a
fix find pr number bug
BigCat20196 Jun 29, 2022
603e3a7
update assignee logic
BigCat20196 Jun 29, 2022
9425655
debug
BigCat20196 Jun 29, 2022
e8afcf3
debug
BigCat20196 Jun 29, 2022
9a89bbe
update python assignee
BigCat20196 Jun 29, 2022
9290c64
Update python.py
msyyc Jun 30, 2022
6edbe7a
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 6, 2022
055c2e7
debug
BigCat20196 Jul 6, 2022
0c7744f
debug
BigCat20196 Jul 6, 2022
5642eab
delete useless code
BigCat20196 Jul 6, 2022
4918eee
Update scripts/release_helper/python.py
BigCat20196 Jul 6, 2022
9929de2
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
BigCat20196 Jul 7, 2022
c5d19c8
add multi api policy
BigCat20196 Jul 7, 2022
53d15db
add tag inconsystency
BigCat20196 Jul 8, 2022
8483a4d
add specified tag
BigCat20196 Jul 11, 2022
891784b
Update scripts/release_helper/python.py
BigCat20196 Jul 12, 2022
069def5
update
BigCat20196 Jul 12, 2022
a719856
update multiapi policy
BigCat20196 Jul 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions scripts/release_helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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) '
Expand All @@ -174,7 +176,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)
Expand Down Expand Up @@ -252,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

Expand All @@ -267,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()
Expand Down
21 changes: 18 additions & 3 deletions scripts/release_helper/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
_AUTO_ASK_FOR_CHECK = 'auto-ask-check'
_BRANCH_ATTENTION = 'base-branch-attention'
_7_DAY_ATTENTION = '7days attention'
_MultiAPI = 'MultiAPI'
# record published issues
_FILE_OUT = 'published_issues_python.csv'

Expand All @@ -29,6 +30,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
Expand All @@ -41,10 +43,18 @@ 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 multi_api_policy(self) -> None:
if self.is_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)

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'
Expand All @@ -53,10 +63,11 @@ 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 = (_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}'
self.edit_content = f'\n{self.readme_link.replace("/readme.md", "")}\n{self.package_name}' \
f'\nReadme Tag: {self.target_readme_tag}'
msyyc marked this conversation as resolved.
Show resolved Hide resolved

@property
def readme_comparison(self) -> bool:
Expand All @@ -79,9 +90,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')
Expand Down Expand Up @@ -111,9 +124,11 @@ def remind_policy(self):

def auto_bot_advice(self):
super().auto_bot_advice()
self.multi_api_policy()
self.attention_policy()
self.remind_policy()


def auto_close(self) -> None:
if AUTO_CLOSE_LABEL in self.issue_package.labels_name:
return
Expand Down
7 changes: 6 additions & 1 deletion scripts/release_helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -71,7 +72,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": {
Expand All @@ -97,6 +98,10 @@ def run_pipeline(issue_link, pipeline_url, spec_readme):
"SPEC_README": {
"value": spec_readme,
"isSecret": False
},
"PYTHON_TAG": {
"value": python_tag,
"isSecret": False
}
}
}
Expand Down