Skip to content

Commit

Permalink
fix(vcs): add extra context to errors and increase timeouts (#2037)
Browse files Browse the repository at this point in the history
* give a more complete message on vcs error

* bump timeouts for vcs checking
  • Loading branch information
Jguer authored Mar 30, 2023
1 parent 68337a5 commit 01666ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/upgrade/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func UpDevel(
toRemove := make([]string, 0)
toUpgrade := UpSlice{Up: make([]Upgrade, 0), Repos: []string{"devel"}}

ctxTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
ctxTimeout, cancel := context.WithTimeout(ctx, 20*time.Second)
defer cancel()
for pkgName, pkg := range remote {
if localCache.ToUpgrade(ctxTimeout, pkgName) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@ func (v *InfoStore) getCommit(ctx context.Context, url, branch string, protocols
if len(protocols) > 0 {
protocol := protocols[len(protocols)-1]

ctxTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
ctxTimeout, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()

cmd := v.CmdBuilder.BuildGitCmd(ctxTimeout, "", "ls-remote", protocol+"://"+url, branch)

stdout, _, err := v.CmdBuilder.Capture(cmd)
stdout, stderr, err := v.CmdBuilder.Capture(cmd)
if err != nil {
exitError := &exec.ExitError{}
if ok := errors.As(err, &exitError); ok && exitError.ExitCode() == 128 {
v.logger.Warnln(gotext.Get("devel check for package failed: '%s' encountered an error", cmd.String()))
v.logger.Warnln(gotext.Get("devel check for package failed: '%s' encountered an error", cmd.String()), ": ", stderr)
return ""
}

v.logger.Warnln(err)
v.logger.Warnln(gotext.Get("devel check for package failed: '%s' encountered an error", cmd.String()), ": ", err)

return ""
}
Expand Down

0 comments on commit 01666ae

Please sign in to comment.