Skip to content

Add script for checking the status of the backports#11065

Merged
alecslupu merged 37 commits intodevelopfrom
chore/backporter-checker
Jul 24, 2023
Merged

Add script for checking the status of the backports#11065
alecslupu merged 37 commits intodevelopfrom
chore/backporter-checker

Conversation

@andreslucena
Copy link
Copy Markdown
Member

@andreslucena andreslucena commented Jun 19, 2023

🎩 What? Why?

This PR introduces a companion for the bin/backporter script. The idea is to be able to see which Pull Requests with the type: fix label have backport PRs already created and related to them.

$ ./bin/backports_checker 
No value provided for required options '--github-token', '--last-version-number'
$ ./bin/backports_checker  --help
Usage:
  backports_checker --github-token=GITHUB_TOKEN --last-version-number=LAST_VERSION_NUMBER

Options:
  --github-token=GITHUB_TOKEN                # Required. Github Personal Access Token (PAT). It can be obtained from https://github.com/settings/tokens/new. You will need to create one with `public_repo` access.
  --last-version-number=LAST_VERSION_NUMBER  # Required. The version number of the last supported version that you want to do the backports to. It must have the format MAJOR.MINOR.
  [--days-to-check-from=N]                   # How many days we will check from.
                                             # Default: 90

Backports checker. Shows the status of the pull requests opened in the last days

The output by default is for the terminal. It uses a color code to differentiate the status of the Pull Requests, following the colors of GitHub:
- Purple: closed with a merge
- Red: closed without being merge
- Green: opened without being merge

Example command:

$ ./bin/backports_checker --github-token=<GH_PAT_TOKEN> --days_to_check_from=30 --last_version_number=0.27

Screenshot of the backporter checker script

There's also a CSVReporter, that will allow us in the future to make a TUI or something like that that will allow us to use the output of this script as the input for the backporter script (see #9281)

📌 Related Issues

Testing

Run the script ./bin/backports_checker

♥️ Thank you!

@andreslucena andreslucena added the type: internal PRs that aren't necessary to add to the CHANGELOG for implementers label Jun 19, 2023
@andreslucena andreslucena marked this pull request as draft June 21, 2023 07:09
@andreslucena andreslucena force-pushed the chore/backporter-checker branch 2 times, most recently from ccc8418 to fa7a108 Compare July 5, 2023 07:58
@andreslucena andreslucena marked this pull request as ready for review July 5, 2023 08:34
@andreslucena andreslucena force-pushed the chore/backporter-checker branch from a128f36 to 1ec6521 Compare July 5, 2023 11:09
@andreslucena andreslucena requested a review from a team July 5, 2023 11:41
@andreslucena andreslucena marked this pull request as draft July 18, 2023 16:40
@andreslucena andreslucena force-pushed the chore/backporter-checker branch from 2f362c0 to c7e6607 Compare July 18, 2023 16:44
@alecslupu
Copy link
Copy Markdown
Contributor

I was just looking through this PR (from user point of view), and i have a few suggestions:

  • When running ./bin/backports_checker --github-token ... i have received uninitialized constant ActiveSupport::IsolatedExecutionState (NameError) error, but works fine when using ./bin/bundle
  • The title field, should display only a certain number of characters. If the PR is Longer, we should truncate :
    image

I am already thinking about a command argument that could be added, so that we can schedule running weekly the task in github actions.

@alecslupu
Copy link
Copy Markdown
Contributor

On the other hand, when running

./bin/bundle exec ./bin/backports_checker --days_to_check_from=360 --github-token=... --last-version-number=0.27

I came across:

| #9791 | Fix leaking emails on admin user search controller                                  |      None      |      None      |

#9791 is already backported, but some reason is being marked as "to do".

@andreslucena
Copy link
Copy Markdown
Member Author

  • When running ./bin/backports_checker --github-token ... i have received uninitialized constant ActiveSupport::IsolatedExecutionState (NameError) error, but works fine when using ./bin/bundle

Mmmm that one is weird. I can confirm that the command that I'm using is ./bin/backports_checker. There's probably a difference between our environments or something like that.

As far as I know I try to not use Rails APIs, and if I use them I require them, as we're outside the Rails environment

The title field, should display only a certain number of characters. If the PR is Longer, we should truncate :

I was just giving it one last look and found that one too. It's fixed on c11ce71

#9791 is already backported, but some reason is being marked as "to do".

I think that's because the title was missing the "v" in "v0.26". The big assumption of this script is that the backports need to comply with the titles created with the "bin/backporter" script, so I can extract it all with the GitHub API. I guess I could have checked it with the git CLI too, but well, I went with this other approach as it was what we usually do manually to check if the backport was done or not.

I fixed those titles and now it should appear as backported.

@andreslucena
Copy link
Copy Markdown
Member Author

I fixed those titles and now it should appear as backported.

Confirmed:

| #9791 | Fix leaking emails on admin user search controller                                  |      #9796     |      #9797     |

@andreslucena andreslucena marked this pull request as ready for review July 19, 2023 07:43
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

Tested Locally, LGTM

@alecslupu alecslupu merged commit 033111e into develop Jul 24, 2023
@alecslupu alecslupu deleted the chore/backporter-checker branch July 24, 2023 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: internal PRs that aren't necessary to add to the CHANGELOG for implementers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants