From 01666aef373c431698b2ba59fc6eb294cfb810f4 Mon Sep 17 00:00:00 2001 From: Jo Date: Thu, 30 Mar 2023 19:57:56 +0100 Subject: [PATCH] fix(vcs): add extra context to errors and increase timeouts (#2037) * give a more complete message on vcs error * bump timeouts for vcs checking --- pkg/upgrade/sources.go | 2 +- pkg/vcs/vcs.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/upgrade/sources.go b/pkg/upgrade/sources.go index 720424d5b..1e400049a 100644 --- a/pkg/upgrade/sources.go +++ b/pkg/upgrade/sources.go @@ -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) { diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index 603012d7b..ca3442f8c 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -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 "" }