From 8daabab53975a50db2b6c3410a1ca2d68bde1c29 Mon Sep 17 00:00:00 2001 From: Vault Automation Date: Wed, 7 Jan 2026 14:19:40 -0700 Subject: [PATCH] pipeline(backport) PR titles on CE backports of backports are convoluted (#10943) (#11632) * Use a secondary template instead * formatting Co-authored-by: Luis (LT) Carbonell --- .../internal/pkg/github/create_backport.go | 16 +++++++-- .../templates/backport-ce-pr-message.tmpl | 34 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tools/pipeline/internal/pkg/github/templates/backport-ce-pr-message.tmpl diff --git a/tools/pipeline/internal/pkg/github/create_backport.go b/tools/pipeline/internal/pkg/github/create_backport.go index 3cde8dd66b..9353c03aa3 100644 --- a/tools/pipeline/internal/pkg/github/create_backport.go +++ b/tools/pipeline/internal/pkg/github/create_backport.go @@ -688,8 +688,20 @@ func (r *CreateBackportReq) backportRef( return res } - prTitle := fmt.Sprintf("Backport %s into %s", pr.GetTitle(), ref) - prBody, err := renderEmbeddedTemplate("backport-pr-message.tmpl", struct { + // Generate title, removing existing "Backport" prefix to avoid stuttering + cleanTitle := pr.GetTitle() + if strings.HasPrefix(strings.ToLower(cleanTitle), "backport ") { + cleanTitle = strings.TrimSpace(cleanTitle[9:]) // Remove "Backport " prefix + } + prTitle := fmt.Sprintf("Backport %s into %s", cleanTitle, ref) + + // Choose template based on whether this is a CE backport + templateName := "backport-pr-message.tmpl" + if r.hasCEPrefix(ref) { + templateName = "backport-ce-pr-message.tmpl" + } + + prBody, err := renderEmbeddedTemplate(templateName, struct { OriginPullRequest *libgithub.PullRequest Attempt *CreateBackportAttempt }{pr, res}) diff --git a/tools/pipeline/internal/pkg/github/templates/backport-ce-pr-message.tmpl b/tools/pipeline/internal/pkg/github/templates/backport-ce-pr-message.tmpl new file mode 100644 index 0000000000..0ebb774bbf --- /dev/null +++ b/tools/pipeline/internal/pkg/github/templates/backport-ce-pr-message.tmpl @@ -0,0 +1,34 @@ +## Backport Enterprise PR #{{ .OriginPullRequest.Number }}{{ if .Attempt.TargetRef }} into {{ .Attempt.TargetRef }} {{ end }} + +{{ if .Attempt.Error }} +:rotating_light: +>**Warning** automatic backport of commits failed. If the first commit failed, +you will see a blank no-op commit below. If at least one commit succeeded, you +will see the backported commits up to, _but not including_, the commit where +the merge conflict occurred. + +The person who merged in the original PR is: @{{ .OriginPullRequest.GetMergedBy.GetLogin }} +This person should resolve the merge-conflict(s) by either: +* Manually completing the backports into this branch +* Creating a new branch and manually backporting all commits + +Error(s) encountered while attempting the backport: +> {{ .Attempt.Error }} + +To continue the backport process, please follow the instructions below: + +1. Checkout the branch in this PR locally (or optionally create a new branch off {{ .OriginPullRequest.GetBase.GetRef }}) +1. Manually cherry-pick the missing commits from the original PR into this branch: + 1. Cherry-pick the commits from the original PR into this branch `git cherry-pick ` (see Overview of unprocessed commits below for the list of commits to cherry-pick) + 1. Resolve any conflicts that arise + 1. Remove any CE only files if the backport target branch is to ce + 1. Push the changes to this branch +1. Update the PR description to reflect the new commit(s) + +{{ end }} + +The following text was copied from the body of the original pull request + +--- + +{{ .OriginPullRequest.Body }}