diff --git a/cmd/osbuild-worker/jobimpl-osbuild.go b/cmd/osbuild-worker/jobimpl-osbuild.go index 98945de0b0..78c4563682 100644 --- a/cmd/osbuild-worker/jobimpl-osbuild.go +++ b/cmd/osbuild-worker/jobimpl-osbuild.go @@ -542,6 +542,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error { return err } + var failedStage string // Include pipeline stages output inside the worker's logs. // Order pipelines based on PipelineNames from job for _, pipelineName := range osbuildJobResult.PipelineNames.All() { @@ -556,6 +557,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error { logWithId.Infof(" %s success", stageResult.Type) } else { logWithId.Infof(" %s failure:", stageResult.Type) + failedStage = stageResult.Type stageOutput := strings.Split(stageResult.Output, "\n") for _, line := range stageOutput { logWithId.Infof(" %s", line) @@ -575,7 +577,12 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error { osbErrors = append(osbErrors, fmt.Sprintf("manifest validation error: %v", err)) } } - osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, "osbuild build failed", osbErrors) + + reason := "osbuild build failed" + if len(failedStage) > 0 { + reason += " in stage:\n" + failedStage + } + osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, reason, osbErrors) return nil }