cloupapi/v2: add koji support

Extend the compose endpoints to have minimal koji support.

This is intended to replace the current koji API so that it
can be consumed through api.openshift.com.
This commit is contained in:
Tom Gundersen 2022-01-22 17:39:48 +00:00
parent 22b923dee3
commit 92c7fc2534
7 changed files with 358 additions and 131 deletions

View file

@ -87,6 +87,29 @@ func (impl *OSBuildKojiJobImpl) Run(job worker.Job) error {
return err
}
// In case the manifest is empty, try to get it from dynamic args
if len(args.Manifest) == 0 {
if job.NDynamicArgs() > 1 {
var manifestJR worker.ManifestJobByIDResult
err = job.DynamicArgs(1, &manifestJR)
if err != nil {
return err
}
// skip the job if the manifest generation failed
if manifestJR.JobError != nil {
result.JobError = clienterrors.WorkerClientError(clienterrors.ErrorManifestDependency, "Manifest dependency failed")
return nil
}
args.Manifest = manifestJR.Manifest
if len(args.Manifest) == 0 {
return fmt.Errorf("received empty manifest")
}
} else {
return fmt.Errorf("job has no manifest")
}
}
if initArgs.JobError == nil {
exports := args.Exports
if len(exports) == 0 {