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

Remove newlines from kubeVersion field #3002

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tools/version-tracker/pkg/commands/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ func getLatestEKSDistroRelease(client *gogithub.Client, branch string) (int, str
return 0, "", fmt.Errorf("error converting release number to integer: %v", err)
}

return releaseNumberInt, string(kubeVersion), nil
kubeVersionTrimmed := strings.TrimRight(string(kubeVersion), "\n")

return releaseNumberInt, kubeVersionTrimmed, nil
}

// updateProjectVersionFile updates the version information stored in a specific file.
Expand Down
7 changes: 6 additions & 1 deletion tools/version-tracker/pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ func CreatePullRequest(client *github.Client, org, repo, title, body, baseRepoOw
pullRequest = pullRequests[0]
logger.Info(fmt.Sprintf("A pull request already exists for %s:%s\n", headRepoOwner, headBranch), "Pull request", *pullRequest.HTMLURL)

pullRequest.Body = github.String(body)
pullRequest, _, err = client.PullRequests.Edit(context.Background(), baseRepoOwner, constants.BuildToolingRepoName, *pullRequest.Number, pullRequest)
if err != nil {
return fmt.Errorf("editing existing pull request %s: %v", pullRequest.HTMLURL, err)
}

// If patches to the project failed to apply, check if the PR already has a comment warning about
// the incomplete PR and patches needing to be regenerated.
if !patchApplySucceeded {
Expand All @@ -381,7 +387,6 @@ func CreatePullRequest(client *github.Client, org, repo, title, body, baseRepoOw
Body: github.String(body),
MaintainerCanModify: github.Bool(true),
}

pullRequest, _, err = client.PullRequests.Create(context.Background(), baseRepoOwner, constants.BuildToolingRepoName, newPR)
if err != nil {
return fmt.Errorf("creating pull request with updated versions from %s to %s: %v", headBranch, baseBranch, err)
Expand Down