worker: allow passing different jobs to workers
Until now, all jobs were put as "osbuild" jobs into the job queue and the worker API hard-coded sending an osbuild manifest and upload targets. Change the API to take a "type" and "args" keys, which are equivalent to the job-queue's type and args. Workers continue to support only osbuild jobs, but this makes other jobs possible in the future.
This commit is contained in:
parent
5b57814664
commit
d3c99b8e93
5 changed files with 39 additions and 20 deletions
|
|
@ -263,12 +263,17 @@ func (h *apiHandlers) RequestJob(ctx echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
serializedArgs, err := json.Marshal(jobArgs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ctx.JSON(http.StatusCreated, requestJobResponse{
|
||||
Id: jobId,
|
||||
Manifest: jobArgs.Manifest,
|
||||
Targets: jobArgs.Targets,
|
||||
Location: fmt.Sprintf("/jobs/%v", token),
|
||||
ArtifactLocation: fmt.Sprintf("/jobs/%v/artifacts/", token),
|
||||
Type: "osbuild",
|
||||
Args: serializedArgs,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue