-
Notifications
You must be signed in to change notification settings - Fork 519
Add options to generate and push the JSON version of the release notes #1185
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
Conversation
/retest |
/retest |
/test pull-release-test |
Mmh I think something's up with this test ...
|
Hey @puerco, can you please change the release notes in this PR to contain everything within a single release-notes block? Like
|
Is this a little better? |
Yes this is better, thank you! :) I will take care of fixing the CI bug and reviewing your PR in the meanwhile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, its generally LGTM. See my comments for more input 👇
cmd/krel/cmd/release_notes.go
Outdated
// amend the latest commit | ||
userName, err := command.New("git", "config", "--get", "user.name").RunSuccessOutput() | ||
if err != nil { | ||
return errors.Wrap(err, "while trying to get the user's name") | ||
} | ||
|
||
userEmail, err := command.New("git", "config", "--get", "user.email").RunSuccessOutput() | ||
if err != nil { | ||
return errors.Wrap(err, "while trying to get the user's name") | ||
} | ||
|
||
logrus.Infof("amending the last commit to the user's config: %v <%v>", userName.OutputTrimNL(), userEmail.OutputTrimNL()) | ||
|
||
if err := command.NewWithWorkDir( | ||
repository.Dir(), "git", "commit", "--amend", "--signoff", "--no-edit", | ||
"--author", fmt.Sprintf("%v <%v>", userName.OutputTrimNL(), userEmail.OutputTrimNL()), | ||
).RunSilentSuccess(); err != nil { | ||
return errors.Wrap(err, "amending commit with user's data") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that we should change the repo.Commit
method to streamline this. Can we add a TODO here to indicate that this might be simplified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a new Commit function CommitWithOptions
to the git package which can get custom options for the commit. I modified the Commit
function to use it and to send the release notes PRs on behalf of the user, I added a new UserCommit
function which reads the user data from the local git.
// tryToFindPreviuousTag gets a release tag and returns the one before it | ||
func tryToFindPreviuousTag(tag string) (string, error) { | ||
url, err := git.GetDefaultKubernetesRepoURL() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
status, err := command.New( | ||
"git", "ls-remote", "--sort=v:refname", | ||
"--tags", url, | ||
). | ||
Pipe("grep", "-Eo", "v[0-9].[0-9]+.[0-9]+[-a-z0-9\\.]*$"). | ||
Pipe("grep", "-B1", tag). | ||
Pipe("head", "-1"). | ||
RunSilentSuccessOutput() | ||
|
||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return strings.TrimSpace(status.Output()), nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should be part of the git
package. I would also make it a bit more flexible by maybe introducing only a new LSRemote()
function.
(I think this can be done in a follow-up PR as well.)
/retest |
/test pull-release-test |
We probably have to increase the timeout in
|
@puerco can you please rebase on top of the latest master and drop that merge commit? |
@saschagrunert yes I'm sorry, I switched computers to continue work on this and accidentally pushed the merge commit. I'll send the updates in a little bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: puerco, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds to krel a new feature to generate the kubernetes release notes in the json format required by relnotes.k8s.io. When enabling this feature via
--create-website-pr
it will create a branch in the user's fork of kubernetes/sig-release (determined by--website-org
/--website-repo
) where it will generate the json file and patch the assets.ts file. After that, it will commit the changes and push them to the user's fork.Which issue(s) this PR fixes:
Fixes #1061
Related to #834
Special notes for your reviewer:
Some notes for this PR:
Does this PR introduce a user-facing change?
This change adds four new flags to the krel release-notes subcommand
After this change it is not longer possible to run
--create-website-pr
and--create-draft-pr
during the same invocation.