Skip to content

ceph-backport.sh: implement --milestones feature and more-careful vetting#30879

Merged
smithfarm merged 13 commits intoceph:masterfrom
smithfarm:wip-cbs-check-missing-milestone
Oct 30, 2019
Merged

ceph-backport.sh: implement --milestones feature and more-careful vetting#30879
smithfarm merged 13 commits intoceph:masterfrom
smithfarm:wip-cbs-check-missing-milestone

Conversation

@smithfarm
Copy link
Contributor

@smithfarm smithfarm commented Oct 12, 2019

This PR implements ceph-backport.sh --milestones which will find and fix PRs that are missing a milestone (or have the wrong milestone).

It also tries to be more careful in several areas:

  • refuse to stage a backport if the backport tracker issue is closed
  • check that the Backport tracker issue's "release" field is actually one of the active milestones on GitHub
  • if github_user is not set, do not fall back to $USER (this leads to confusing behavior when the actual GitHub username is something other than $USER)
  • even when github_token is set, do an actual GitHub API call and bail out if GitHub does not recognize the token
  • refuse to cherry-pick from a PR that targets any branch other than ceph:master
  • refuse to cherry-pick from a PR that isn't merged

@smithfarm smithfarm requested a review from jan--f October 12, 2019 10:55
@smithfarm smithfarm changed the title ceph-backport.sh: stricter vetting of backport issue ceph-backport.sh: implement --check-milestones feature and stricter vetting of backport issue Oct 14, 2019
@smithfarm smithfarm added feature and removed bug-fix labels Oct 14, 2019
@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch 2 times, most recently from f7c5efa to 2e3453a Compare October 14, 2019 11:05
@smithfarm smithfarm requested review from theanalyst and yuriw October 14, 2019 12:10
@smithfarm
Copy link
Contributor Author

@theanalyst @yuriw This PR implements ceph-backport.sh --check-milestones which will find and fix PRs that are missing a milestone (or have the wrong milestone).

@smithfarm smithfarm requested a review from tchaikov October 14, 2019 12:13
@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch from 2e3453a to 5f73870 Compare October 14, 2019 21:28
@yuriw
Copy link
Contributor

yuriw commented Oct 20, 2019

@smithfarm defer to @theanalyst

@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch from 5f73870 to e9e3be1 Compare October 21, 2019 19:26
@smithfarm smithfarm requested a review from ifed01 October 21, 2019 19:26
@smithfarm smithfarm changed the title ceph-backport.sh: implement --check-milestones feature and stricter vetting of backport issue ceph-backport.sh: implement --check-milestones feature and vet more carefully Oct 21, 2019
@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch from b4c1f00 to 61728fc Compare October 21, 2019 20:17
@smithfarm smithfarm changed the title ceph-backport.sh: implement --check-milestones feature and vet more carefully ceph-backport.sh: implement --check-milestones feature and more-careful vetting Oct 21, 2019
@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch 2 times, most recently from 6af5d8c to 92d9258 Compare October 22, 2019 10:59
Refuse to work on a backport that is

* not in "New" or "Need More Info" status
* targeting a release that is not among the GitHub active milestones

Signed-off-by: Nathan Cutler <ncutler@suse.com>
When --milestones is provided, the script will:

1. determine the set of active milestones by querying GitHub API
2. for each active milestone, get all PRs targeting the milestone, regardless of
   actual milestone setting
3. for each PR targeting an active milestone, check that actual milestone
   setting matches the base branch
4. if a problem is detected, fix it and "flag" the PR
5. at the end, print a report summarizing any problems that were detected

Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
Before, the script was satisfied if the variable github_token was set to *any*
value. With this commit, it is only satisfied if the GitHub API recognizes it as
a valid token.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
When the script is run from outside the git clone, that's a sign that
the user may be a new user who has not yet completed setup.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
It's very common for folks to be logged into their local machine as something
other than their GitHub username. When github_user is not set, assume the user
has not yet done setup: emit an error and explain how to get setup advice.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
Two of the variables used were not declared as local.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch from 92d9258 to e65a105 Compare October 23, 2019 11:00
@smithfarm smithfarm changed the title ceph-backport.sh: implement --check-milestones feature and more-careful vetting ceph-backport.sh: implement --milestones feature and more-careful vetting Oct 23, 2019
Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Nathan Cutler <ncutler@suse.com>
And really stop after cherry-pick phase.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
@smithfarm smithfarm force-pushed the wip-cbs-check-missing-milestone branch from b5abfb1 to a333cf4 Compare October 24, 2019 11:52
@smithfarm smithfarm requested a review from callithea October 24, 2019 11:52
Copy link
Member

@theanalyst theanalyst left a comment

Choose a reason for hiding this comment

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

Looks good

if [ "$tslc_is_ok" ] ; then
true
else
if [ "$tslc" = "in progress" ] ; then
Copy link
Member

Choose a reason for hiding this comment

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

There might be cases where someone took up a tracker issue, marked as in-progress and is stale now, how should these cases be handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--force option is coming in a follow-up PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Currently I'm handling that by manually editing the offending fields of the Backport tracker issue to stop the script from complaining.)

Copy link
Member

Choose a reason for hiding this comment

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

ah cool

Copy link
Contributor

@jan--f jan--f left a comment

Choose a reason for hiding this comment

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

Works for me, I opened a couple of backports with this yesterday (e.g. #31229).

@smithfarm smithfarm merged commit 147f386 into ceph:master Oct 30, 2019
@smithfarm smithfarm deleted the wip-cbs-check-missing-milestone branch October 30, 2019 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants