Skip to content

Commit

Permalink
release: update_versions: continue, even if one repo attempt fails
Browse files Browse the repository at this point in the history
Follow-up to cockroachdb#130063:
after merging 130063, update_versions failed to complete[1], due
to encountering another / different error.

This commit adjusts update_versions so that it continues &
attempts to create PRs for all the remaining repos, despite
encountering errors along the way.

[1] Latest "Create version update PRs" job: https://teamcity.cockroachdb.com/buildConfiguration/Internal_Cockroach_Release_Publish_CreateVersionUpdatePRs/16752534?buildTab=log&focusLine=3552&logView=flowAware&expandAll=true

Release note: None
Epic: None
Release justification: release-infra only change.
  • Loading branch information
celiala committed Sep 4, 2024
1 parent b74b513 commit 58f0a44
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions pkg/cmd/release/update_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ func updateVersions(_ *cobra.Command, _ []string) error {
for _, repo := range reposToWorkOn {
repo.workOnRepoError = workOnRepo(repo)
if repo.workOnRepoError != nil {
log.Printf("workOnRepo: error occurred while working on %s: %s", repo.name(), repo.workOnRepoError)
workOnRepoErrors = append(workOnRepoErrors, repo.workOnRepoError)
err = fmt.Errorf("workOnRepo: error occurred while working on repo %s: %w", repo.name(), err)
workOnRepoErrors = append(workOnRepoErrors, err)
log.Printf("%s", err)
}
}

Expand All @@ -305,27 +306,38 @@ func updateVersions(_ *cobra.Command, _ []string) error {
// run multiple times.
prDesc, err := repo.prExists()
if err != nil {
return fmt.Errorf("checking pr: %w", err)
err = fmt.Errorf("error while checking if pull request exists for repo %s: %w", repo.name(), err)
workOnRepoErrors = append(workOnRepoErrors, err)
log.Printf("%s", err)
continue
}
if prDesc != "" {
log.Printf("pull request for %s already exists: %s", repo.name(), prDesc)
continue
}
log.Printf("pushing changes to repo %s in %s", repo.name(), dest)
if err := repo.push(); err != nil {
return fmt.Errorf("cannot push changes for %s: %w", repo.name(), err)
err = fmt.Errorf("error while pushing changes to repo %s: %w", repo.name(), err)
workOnRepoErrors = append(workOnRepoErrors, err)
log.Printf("%s", err)
continue
}
log.Printf("creating pull request for %s in %s", repo.name(), dest)
pr, err := repo.createPullRequest()
if err != nil {
return fmt.Errorf("cannot create pull request for %s: %w", repo.name(), err)
err = fmt.Errorf("error creating pull request for %s: %w", repo.name(), err)
workOnRepoErrors = append(workOnRepoErrors, err)
log.Printf("%s", err)
continue
}
log.Printf("Created PR: %s\n", pr)
prs = append(prs, pr)
}

if err := sendPrReport(releasedVersion, prs, smtpPassword); err != nil {
return fmt.Errorf("cannot send email: %w", err)
err = fmt.Errorf("error sending email: %w", err)
workOnRepoErrors = append(workOnRepoErrors, err)
log.Printf("%s", err)
}
if len(workOnRepoErrors) > 0 {
return errors.Join(workOnRepoErrors...)
Expand Down

0 comments on commit 58f0a44

Please sign in to comment.