worker/osbuild: provide more details and logs when osbuild build fails
Add any errors to job error details when an osbuild build fails. Otherwise these won't show up in the worker log, which makes debugging issues harder. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
0690b6f1ba
commit
ae68358a0d
1 changed files with 11 additions and 2 deletions
|
|
@ -479,7 +479,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
osbuildJobResult.OSBuildOutput, err = osbuild.RunOSBuild(jobArgs.Manifest, impl.Store, outputDirectory, exports, nil, extraEnv, true, os.Stderr)
|
||||
// First handle the case when "running" osbuild failed
|
||||
if err != nil {
|
||||
osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "osbuild build failed", nil)
|
||||
osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "osbuild build failed", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -507,7 +507,16 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
|
||||
// Second handle the case when the build failed, but osbuild finished successfully
|
||||
if !osbuildJobResult.OSBuildOutput.Success {
|
||||
osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "osbuild build failed", nil)
|
||||
var osbErrors []error
|
||||
if osbuildJobResult.OSBuildOutput.Error != nil {
|
||||
osbErrors = append(osbErrors, fmt.Errorf("osbuild error: %v", osbuildJobResult.OSBuildOutput.Error))
|
||||
}
|
||||
if osbuildJobResult.OSBuildOutput.Errors != nil {
|
||||
for _, err := range osbuildJobResult.OSBuildOutput.Errors {
|
||||
osbErrors = append(osbErrors, fmt.Errorf("manifest validation error: %v", err))
|
||||
}
|
||||
}
|
||||
osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "osbuild build failed", osbErrors)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue