Retry release notes push if failed
It may be possible that multiple release notes jobs trying to push to
the `gh-pages` branch. We now retry to rebase multiple times and only
give-up after a couple of errors.
@@ -259,7 +259,9 @@ To verify the bill of materials (SBOM) in [SPDX](https://spdx.org) format using
return fmt.Errorf("commit: %w", err)
}
- // Other jobs could run in parallel, rebase before pushing
+ // Other jobs could run in parallel, try rebase multiple times before
+ // pushing
+ for i := 0; i < 10; i++ {
if _, err := repo.FetchRemote(git.DefaultRemote); err != nil {
return fmt.Errorf("fetch remote: %w", err)
}
@@ -268,8 +270,13 @@ To verify the bill of materials (SBOM) in [SPDX](https://spdx.org) format using
return fmt.Errorf("rebase to branch %s: %w", branch, err)
}
- if err := repo.Push(branch); err != nil {
- return fmt.Errorf("push changes: %w", err)
+ err := repo.Push(branch)
+ if err == nil {
+ break
+ }
+
+ logrus.Warnf("Failed to push changes, retrying (%d): %v", i, err)
+ time.Sleep(3 * time.Second)
}
return nil
