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

Expanded PR section of code standards doc #6844

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

sseago
Copy link
Collaborator

@sseago sseago commented Sep 19, 2023

Thank you for contributing to Velero!

Please add a summary of your change

Updates code standards doc with some additional content around PR best practices, as discussed in a recent community meeting.

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

  • [x ] Accepted the DCO. Commits without the DCO will delay acceptance.
  • [ x] Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@sseago
Copy link
Collaborator Author

sseago commented Sep 19, 2023

/kind changelog-not-required

@github-actions github-actions bot added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Sep 19, 2023
@weshayutin
Copy link
Contributor

Nice.. Thanks @sseago

Example PR titles:

- "Check for nil when validating foo"
- "Issue #1234: Check for nil when validating foo"
Copy link
Contributor

Choose a reason for hiding this comment

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

since we have issue placeholder in PR template, I would discourage issue ref in PR title (unless this helps with any automation, like what we have for JIRA in OADP)

But I would also add a section explaining how to use the PR template, I saw a lot of misusage

maybe update it with comments to help users fill it (example https://raw.githubusercontent.com/dora-metrics/pelorus/master/.github/PULL_REQUEST_TEMPLATE/general_template.md)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While I don't want to require use of the issue in the title/commit message, I can see some value in including it, since PR template won't show up when looking at commit history. That's why I gave both options -- i.e. if you want the issue in title, that's fine, as long as there's also a description, but just a description is fine too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The most important point (and the main reason for this change) is to make sure that every PR gets a descriptive title -- that "fix issue #foo" alone is insufficient.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sseago unrelated to this PR going in, we can perhaps create github actions to ensure proper naming of PRs?

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #6844 (cd7e2d6) into main (402703f) will increase coverage by 0.21%.
Report is 50 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #6844      +/-   ##
==========================================
+ Coverage   60.46%   60.67%   +0.21%     
==========================================
  Files         242      249       +7     
  Lines       26033    26476     +443     
==========================================
+ Hits        15740    16064     +324     
- Misses       9187     9268      +81     
- Partials     1106     1144      +38     

see 38 files with indirect coverage changes

### Cherry-pick PRs

When a PR to main needs to be cherry-picked to a release branch, please wait until the main PR is merged first before creating the CP PR. If the CP PR is made before the main PR is merged, there is a risk that PR modifications in response to review comments will not make it into the CP PR.

Copy link
Member

Choose a reason for hiding this comment

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

Should add some guideline regarding title for cherry-pick PRs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we perhaps have some automation in form of github actions which can do the manual work of Cherry Pick while also conforming to the title guidelines?

Copy link
Member

@kaovilai kaovilai Sep 26, 2023

Choose a reason for hiding this comment

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

Like kubernetes prow /cherry-pick? would be cool.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@anshulahuja98 @kaovilai Having the ability to cherry-pick via bot would add some options. Note that this sort of automated cherry-pick might require an additional github action (or manual intervention) if there is a changelog file, since the CP PR will have a new number, so the changelog file will need to be renamed. I think that sort of automation is probably out of scope for this PR though and should be considered as a follow-on action/investigation.

Copy link
Member

Choose a reason for hiding this comment

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

@sseago reopen #2663 to continue work on adding prow GH Actions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kaovilai well changelog filename check but also actually changing the filename, since cherry-picking the commit will have the wrong filename. When doing this manually, after cherry-picking the commit and creating the new PR you have to go in and change the filename to match the new PR number and amend the commit.

Copy link
Member

Choose a reason for hiding this comment

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

changing the filename

github actions can do that automatically :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will need to do it after creating the PR, though, since we don't know what the filename will be until the PR exists.

Copy link
Member

Choose a reason for hiding this comment

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

on: pr-comment
if: /cherry-pick <branch>
    cp -R . /tmp/cherry-pick
    change-file-name-to-next-pr|issue-number
    git commit --amend --no-edit --sign-off
    gh pr create --base <branch>

@kaovilai
Copy link
Member

I think it would be good to add cherry-pick PR title guidelines.
#6881 with title Add 'orLabelSelector' for backup, restore command can be unclear at first glance that this is cherry-pick.

@sseago
Copy link
Collaborator Author

sseago commented Sep 29, 2023

@kaovilai "I think it would be good to add cherry-pick PR title guidelines."

Something like this?
"Cherry-pick PR titles should be in the form 'cherry-pick [] ' "

@kaovilai
Copy link
Member

Something like this?
"Cherry-pick PR titles should be in the form 'cherry-pick [] ' "

Sure.
Or <branch-name>: Original PR title

@sseago
Copy link
Collaborator Author

sseago commented Sep 29, 2023

@kaovilai possibly with "CP" in there too? To distinguish between "this is a cherry-pick PR for a release branch" vs. "this is an original commit for a release branch"? Not sure it's necessary, but it gives a clue to a reviewer that if it's an original commit it probably warrants a closer review than a CP.

@kaovilai
Copy link
Member

possibly with "CP" in there too?

sure

@shubham-pampattiwar
Copy link
Collaborator

/kind changelog-not-required

@sseago
Copy link
Collaborator Author

sseago commented Oct 4, 2023

Updated in response to feedback

@shubham-pampattiwar shubham-pampattiwar merged commit 541425b into vmware-tanzu:main Oct 9, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants