fix(vcs): add extra context to errors and increase timeouts (#2037)

* give a more complete message on vcs error

* bump timeouts for vcs checking
This commit is contained in:
Jo 2023-03-30 19:57:56 +01:00 committed by GitHub
parent 68337a58c1
commit 01666aef37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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 ""
}