progress: do not return if osbuild status json reading fails

This commit tweaks an issue that potentially an incorrect status
from osbuild would fail the build with a bad error message and
without us getting the full buildlog.
This commit is contained in:
Michael Vogt 2025-01-27 13:53:23 +01:00 committed by Simon de Vlieger
parent 655b6bbd0f
commit 0e1a0f8ace
2 changed files with 21 additions and 2 deletions

View file

@ -368,10 +368,12 @@ func runOSBuildWithProgress(pb ProgressBar, manifest []byte, store, outputDirect
}
wp.Close()
var statusErrs []error
for {
st, err := osbuildStatus.Status()
if err != nil {
return fmt.Errorf("error reading osbuild status: %w", err)
statusErrs = append(statusErrs, err)
continue
}
if st == nil {
break
@ -392,6 +394,9 @@ func runOSBuildWithProgress(pb ProgressBar, manifest []byte, store, outputDirect
if err := cmd.Wait(); err != nil {
return fmt.Errorf("error running osbuild: %w\nOutput:\n%s", err, stdio.String())
}
if len(statusErrs) > 0 {
return fmt.Errorf("errors parsing osbuild status:\n%w", errors.Join(statusErrs...))
}
return nil
}