Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
df04f33a
Commit
df04f33a
authored
Oct 27, 2016
by
Ryan Hitchman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make update_owners.py assign new tests to self by default.
parent
a266f72b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
update_owners.py
hack/update_owners.py
+20
-7
No files found.
hack/update_owners.py
View file @
df04f33a
...
...
@@ -115,10 +115,19 @@ def get_maintainers():
return
sorted
(
ret
-
SKIP_MAINTAINERS
)
def
detect_github_username
():
remotes
=
subprocess
.
check_output
([
'git'
,
'remote'
,
'-v'
])
repos
=
set
(
re
.
findall
(
r'\w+(?=/kubernetes)'
,
remotes
))
repos
.
remove
(
'kubernetes'
)
if
len
(
repos
)
==
1
:
return
repos
.
pop
()
raise
ValueError
(
'unable to guess GitHub user from `git remote -v` output, use --user instead'
)
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--history'
,
action
=
'store_true'
,
help
=
'Generate test list from result history.'
)
parser
.
add_argument
(
'--user'
,
help
=
'User to assign new tests to (
default: random
).'
)
parser
.
add_argument
(
'--user'
,
help
=
'User to assign new tests to (
or RANDOM, default: current GitHub user
).'
)
parser
.
add_argument
(
'--check'
,
action
=
'store_true'
,
help
=
'Exit with a nonzero status if the test list has changed.'
)
options
=
parser
.
parse_args
()
...
...
@@ -148,6 +157,9 @@ def main():
sys
.
exit
(
1
)
sys
.
exit
(
0
)
if
not
options
.
user
:
options
.
user
=
detect_github_username
()
for
name
in
outdated_tests
:
owners
.
pop
(
name
)
...
...
@@ -164,17 +176,18 @@ def main():
if
owner
in
maintainers
)
for
test_name
in
set
(
test_names
)
-
set
(
owners
):
random_assignment
=
True
if
options
.
user
:
if
options
.
user
.
lower
()
==
'random'
:
new_owner
,
_count
=
random
.
choice
(
owner_counts
.
most_common
()[
-
4
:])
else
:
new_owner
=
options
.
user
random_assignment
=
False
else
:
new_owner
,
_count
=
random
.
choice
(
owner_counts
.
most_common
()[
-
4
:])
owner_counts
[
new_owner
]
+=
1
owners
[
test_name
]
=
(
new_owner
,
random_assignment
)
print
'# Tests per maintainer:'
for
owner
,
count
in
owner_counts
.
most_common
():
print
'
%-20
s
%3
d'
%
(
owner
,
count
)
if
options
.
user
.
lower
()
==
'random'
:
print
'# Tests per maintainer:'
for
owner
,
count
in
owner_counts
.
most_common
():
print
'
%-20
s
%3
d'
%
(
owner
,
count
)
write_owners
(
OWNERS_PATH
,
owners
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment