Skip to content

Commit

Permalink
update how release branches are identified (#5512) (#5961)
Browse files Browse the repository at this point in the history
Now we also need to account for the 8.x branch, therefore the process to identify release branches were updated to account for the 8.x

(cherry picked from commit 34a9830)

Co-authored-by: Anderson Queiroz <[email protected]>
  • Loading branch information
mergify[bot] and AndersonQ authored Nov 7, 2024
1 parent 0f22fd2 commit 0ab98c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/testing/tools/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

var (
ErrNotReleaseBranch = errors.New("this is not a release branch")
releaseBranchRegexp = regexp.MustCompile(`.*(\d+\.\d+)$`)
releaseBranchRegexp = regexp.MustCompile(`.*(\d+\.(\d+|x))$`)
)

type outputReader func(io.Reader) error
Expand All @@ -26,7 +26,7 @@ type outputReader func(io.Reader) error
// current repository ordered descending by creation date.
// e.g. 8.13, 8.12, etc.
func GetReleaseBranches(ctx context.Context) ([]string, error) {
c := exec.CommandContext(ctx, "git", "branch", "-r", "--list", "*/[0-9]*.*[0-9]", "--sort=-creatordate")
c := exec.CommandContext(ctx, "git", "branch", "-r", "--list", "*/[0-9]*.*[0-9x]", "--sort=-creatordate")

branchList := []string{}
err := runCommand(c, releaseBranchReader(&branchList))
Expand Down Expand Up @@ -99,8 +99,8 @@ func extractReleaseBranch(branch string) (string, error) {
}

matches := releaseBranchRegexp.FindStringSubmatch(branch)
if len(matches) != 2 {
return "", fmt.Errorf("failed to process branch %q: expected 2 matches, got %d", branch, len(matches))
if len(matches) != 3 {
return "", fmt.Errorf("failed to process branch %q: expected 3 matches, got %d", branch, len(matches))
}
return matches[1], nil
}
Expand Down

0 comments on commit 0ab98c5

Please sign in to comment.