worker/server: build job dep errors
Add a helper function to query dependency failures of osbuild & koji-osbuild jobs. If a build job has a dependency error the function will check for the job error of the manifest job. If that also has a dependency error the function will query the depsolve job too for a job error.
This commit is contained in:
parent
30d75d0e74
commit
da94f2cbeb
1 changed files with 34 additions and 0 deletions
|
|
@ -137,6 +137,40 @@ func (s *Server) enqueue(jobType string, job interface{}, dependencies []uuid.UU
|
|||
return s.jobs.Enqueue(jobType, job, dependencies, channel)
|
||||
}
|
||||
|
||||
func (s *Server) CheckBuildDependencies(dep uuid.UUID, jobErr *clienterrors.Error) error {
|
||||
var depErrs []clienterrors.Error
|
||||
var manifestJR ManifestJobByIDResult
|
||||
_, deps, err := s.ManifestJobStatus(dep, &manifestJR)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if manifestJobErr := manifestJR.JobError; manifestJobErr != nil {
|
||||
if manifestJobErr.HasDependencyError() && len(deps) > 0 {
|
||||
if len(deps) > 1 {
|
||||
return fmt.Errorf("Unexpected number of dependencies received")
|
||||
}
|
||||
|
||||
var depsolveJR DepsolveJobResult
|
||||
_, _, err := s.DepsolveJobStatus(deps[0], &depsolveJR)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if depJobErr := depsolveJR.JobError; depJobErr != nil {
|
||||
depErrs = append(depErrs, *depJobErr)
|
||||
}
|
||||
}
|
||||
|
||||
depErrs = append(depErrs, *manifestJobErr)
|
||||
}
|
||||
|
||||
jobErr.Details = clienterrors.ErrorDetails{
|
||||
FailedDependencies: depErrs,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) OSBuildJobStatus(id uuid.UUID, result *OSBuildJobResult) (*JobStatus, []uuid.UUID, error) {
|
||||
jobType, status, deps, err := s.jobStatus(id, result)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue