worker: implement koji job types
The three new job types osbuild-koji, koji-init, and koji-finalize allows the different tasks to be split appart and in particular for there to be several builds on different architectures as part of a given compose.
This commit is contained in:
parent
a2895376ae
commit
0e382e9cf4
6 changed files with 429 additions and 0 deletions
|
|
@ -25,6 +25,8 @@ type Job interface {
|
|||
Id() uuid.UUID
|
||||
Type() string
|
||||
Args(args interface{}) error
|
||||
DynamicArgs(i int, args interface{}) error
|
||||
NDynamicArgs() int
|
||||
Update(result interface{}) error
|
||||
Canceled() (bool, error)
|
||||
UploadArtifact(name string, reader io.Reader) error
|
||||
|
|
@ -151,6 +153,18 @@ func (j *job) Args(args interface{}) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (j *job) NDynamicArgs() int {
|
||||
return len(j.dynamicArgs)
|
||||
}
|
||||
|
||||
func (j *job) DynamicArgs(i int, args interface{}) error {
|
||||
err := json.Unmarshal(j.dynamicArgs[i], args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing job arguments: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (j *job) Update(result interface{}) error {
|
||||
var buf bytes.Buffer
|
||||
err := json.NewEncoder(&buf).Encode(api.UpdateJobJSONRequestBody{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue