Skip to content

Commit

Permalink
Remove newlines from kubeVersion field
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay-krishna committed Mar 12, 2024
1 parent c5a28cb commit 1cf0291
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 1cf0291

Please sign in to comment.