worker/osbuild: add host OS and architecture to job result

It is generally useful to have this information in the
`OSBuildJobResult`. This information is currently part of the
`OSBuildKojiJobResult`. Instead of moving it to the new
`KojiTargetResultOptions`, lets move it to the `OSBuildJobResult`
structure and set it for all jobs.
This commit is contained in:
Tomas Hozza 2022-06-02 12:24:09 +02:00 committed by Tom Gundersen
parent c7e5e3c9c2
commit bb54318432
2 changed files with 13 additions and 1 deletions

View file

@ -236,8 +236,16 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
Success: false,
},
UploadStatus: "failure",
Arch: common.CurrentArch(),
}
hostOS, err := common.GetRedHatRelease()
if err != nil {
osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorBuildJob, err.Error())
return nil
}
osbuildJobResult.HostOS = hostOS
var outputDirectory string
// In all cases it is necessary to report result back to osbuild-composer worker API.
@ -255,7 +263,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
}
}()
outputDirectory, err := ioutil.TempDir(impl.Output, job.Id().String()+"-*")
outputDirectory, err = ioutil.TempDir(impl.Output, job.Id().String()+"-*")
if err != nil {
return fmt.Errorf("error creating temporary output directory: %v", err)
}

View file

@ -38,6 +38,10 @@ type OSBuildJobResult struct {
TargetErrors []string `json:"target_errors,omitempty"`
UploadStatus string `json:"upload_status"`
PipelineNames *PipelineNames `json:"pipeline_names,omitempty"`
// Host OS of the worker which handled the job
HostOS string `json:"host_os"`
// Architecture of the worker which handled the job
Arch string `json:"arch"`
JobResult
}