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

ptl-tool: load labeled PRs #18231

Merged
merged 1 commit into from Oct 17, 2017
Merged

Conversation

batrick
Copy link
Member

@batrick batrick commented Oct 10, 2017

This lets you label in GitHub the PRs you want to test/merge.

Signed-off-by: Patrick Donnelly pdonnell@redhat.com

@batrick
Copy link
Member Author

batrick commented Oct 10, 2017

@liewegas this is that feature you really wanted: getting PRs that you've previously labeled for merging/testing.

# Adding labeled PR #18192 to PR list
# Will merge PRs: [18192]
# Merging PR #18192
# Leaving HEAD detached; no branch anchors your commit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add this simple example too:

src/script/ptl-tool.py --base master --merge-branch <wip-test-branch> --pr-label wip-<name>-testing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying not to have too many examples. :)

@joscollin
Copy link
Member

The initial test looks fine. But I will do more testing :-)

prs = args.prs
if args.pr_label:
payload = {'labels': args.pr_label, 'sort': 'created', 'direction': 'desc'}
labeled_prs = requests.get("https://api.github.com/repos/ceph/ceph/issues", auth=(USER, PASSWORD), params=payload)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See, created the test branch for an invalid pr-label.

$ src/script/ptl-tool.py --base master --merge-branch wip-jcollin-testing --pr-label wip-jcollin-testing2 #or wip-aoeu-testing
Detaching HEAD onto base: master
Will merge PRs: []
Checked out new branch wip-jcollin-testing-20171011
Created tag testing/wip-jcollin-testing-20171011_04
jcollin@smithi042:~/test-ptl-oct11$ git branch
  master
  * wip-jcollin-testing-20171011

Please check if the branch exists first and drop it. May be move the existing label validation code to a function ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--pr-label ' 'is bypassing it. I have pressed Ctrl+C and it saved me :-D.

jcollin@smithi042:~/test-ptl-oct12$ src/script/ptl-tool.py --base master --merge-branch wip-jcollin-testing --pr-label ' '
Adding labeled PR #18271 to PR list
Adding labeled PR #18270 to PR list
Adding labeled PR #18269 to PR list
Adding labeled PR #18268 to PR list
Adding labeled PR #18267 to PR list
Adding labeled PR #18266 to PR list
Adding labeled PR #18265 to PR list
Adding labeled PR #18264 to PR list
Adding labeled PR #18263 to PR list
Adding labeled PR #18262 to PR list
Adding labeled PR #18261 to PR list
Adding labeled PR #18260 to PR list
Adding labeled PR #18259 to PR list
Adding labeled PR #18257 to PR list
Adding labeled PR #18256 to PR list
Adding labeled PR #18255 to PR list
Adding labeled PR #18254 to PR list
Adding labeled PR #18253 to PR list
Adding labeled PR #18251 to PR list
Adding labeled PR #18250 to PR list
Adding labeled PR #18249 to PR list
Adding labeled PR #18248 to PR list
Adding labeled PR #18247 to PR list
Adding labeled PR #18246 to PR list
Adding labeled PR #18245 to PR list
Adding labeled PR #18244 to PR list
Adding labeled PR #18243 to PR list
Adding labeled PR #18241 to PR list
Adding labeled PR #18240 to PR list
Adding labeled PR #18239 to PR list
Will merge PRs: [18271, 18270, 18269, 18268, 18267, 18266, 18265, 18264, 18263, 18262, 18261, 18260, 18259, 18257, 18256, 18255, 18254, 18253, 18251, 18250, 18249, 18248, 18247, 18246, 18245, 18244, 18243, 18241, 18240, 18239]
Detaching HEAD onto base: master
Merging PR #18271
Labeled PR #18271 wip-jcollin-testing
Merging PR #18270
^CTraceback (most recent call last):
  File "src/script/ptl-tool.py", line 308, in <module>
    
  File "src/script/ptl-tool.py", line 305, in main

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, fixed

Copy link
Member

@joscollin joscollin Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Check the empty string also.
$ src/script/ptl-tool.py --base master --merge-branch wip-jcollin-testing --pr-label ''
Will merge PRs: []
Detaching HEAD onto base: master
Checked out new branch wip-jcollin-testing-20171013
Created tag testing/wip-jcollin-testing-20171013

Adding labeled PR #18284 to PR list

  1. Do we need to add and merge an unreviewed / unapproved PR for testing ? Do we need to check the PR status before the add / merge ?

Copy link
Member Author

@batrick batrick Oct 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the empty string also.

done.

Do we need to add and merge an unreviewed / unapproved PR for testing ? Do we need to check the PR status before the add / merge ?

No, that should stay the ptl's responsibility to check.

@batrick batrick force-pushed the ptl-tool-labeled-prs branch 3 times, most recently from 6a3f1a5 to 38a9e53 Compare October 14, 2017 00:52
@joscollin
Copy link
Member

@batrick I did this to merge wip-ptltool1-testing PRs to my testing branch:
$src/script/ptl-tool.py --base master --merge-branch wip-jcollin-testing --pr-label wip-ptltool1-testing

Then I want to merge wip-ptltool2-testing also to the same testing branch. So I did:

$ src/script/ptl-tool.py --base-path refs/heads/ --base wip-jcollin-testing-20171016 --branch wip-jcollin-testing-20171016 wip-ptltool2-testing
usage: ptl-tool.py [-h] [--branch BRANCH]
                   [--merge-branch-name MERGE_BRANCH_NAME] [--base BASE]
                   [--base-path BASE_PATH] [--git-dir GIT] [--label LABEL]
                   [--pr-label PR_LABEL]
                   [PR [PR ...]]
ptl-tool.py: error: argument PR: invalid int value: 'wip-ptltool2-testing'

Is this expected ? This is working as expected, if I try with the PR number:
$ src/script/ptl-tool.py --base-path refs/heads/ --base wip-jcollin-testing-20171016 --branch wip-jcollin-testing-20171016 18107

But not with the label feature.

This lets you label in GitHub the PRs you want to test/merge.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
@batrick
Copy link
Member Author

batrick commented Oct 17, 2017

@batrick I did this to merge wip-ptltool1-testing PRs to my testing branch:
? $src/script/ptl-tool.py --base master --merge-branch wip-jcollin-testing --pr-label wip-ptltool1-testing

There is no --merge-branch option.

Then I want to merge wip-ptltool2-testing also to the same testing branch. So I did:

$ src/script/ptl-tool.py --base-path refs/heads/ --base wip-jcollin-testing-20171016 --branch wip-jcollin-testing-20171016 wip-ptltool2-testing
usage: ptl-tool.py [-h] [--branch BRANCH]
                   [--merge-branch-name MERGE_BRANCH_NAME] [--base BASE]
                   [--base-path BASE_PATH] [--git-dir GIT] [--label LABEL]
                   [--pr-label PR_LABEL]
                   [PR [PR ...]]
ptl-tool.py: error: argument PR: invalid int value: 'wip-ptltool2-testing'

Looks like you forgot --pr-label wip-ptltool2-testing?

@joscollin
Copy link
Member

@batrick Yes, I missed --pr-label. Sorry for the negligence, I didn't even check the error message.

Copy link
Member

@joscollin joscollin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batrick Now it looks like your original example doesn't create a test branch. It leaves the HEAD detached, but no testing branch created.

I have used:
$ src/script/ptl-tool.py --base master --branch HEAD --merge-branch-name master --label - --pr-label wip-ptltool1-testing

Could you please check that ?

@joscollin
Copy link
Member

joscollin commented Oct 17, 2017

@batrick Oh, that is intended.

leaving a detached HEAD (i.e. do not update your repo's master branch) and do not label

Copy link
Member

@joscollin joscollin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@batrick Looks good to me. I think people can start using the script now, while we continue working on it.

@liewegas @yuriw Do you have any suggestions on this PR ? If nothing at the moment, we could merge this.

@joscollin joscollin merged commit 24dacf5 into ceph:master Oct 17, 2017
@joscollin
Copy link
Member

Merged as this is an independent script (doesn't break anything else).

@batrick batrick deleted the ptl-tool-labeled-prs branch October 25, 2017 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants