worker: require workers to pass their architecture

Jobs are scheduled with type "osbuild:{arch}", to ensure that workers
only get jobs with the right architecture assigned.
This commit is contained in:
Lars Karlitski 2020-09-20 20:16:18 +02:00 committed by Tom Gundersen
parent 44c2144994
commit 9008a1defc
10 changed files with 59 additions and 19 deletions

View file

@ -95,6 +95,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
type imageRequest struct {
manifest distro.Manifest
arch string
filename string
}
imageRequests := make([]imageRequest, len(request.ImageRequests))
@ -135,6 +136,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
}
imageRequests[i].manifest = manifest
imageRequests[i].arch = arch.Name()
imageRequests[i].filename = imageType.Filename()
}
@ -170,7 +172,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Could not initialize build with koji: %v", err))
}
id, err := h.server.workers.Enqueue(ir.manifest, []*target.Target{
id, err := h.server.workers.Enqueue(ir.arch, ir.manifest, []*target.Target{
target.NewKojiTarget(&target.KojiTargetOptions{
BuildID: uint64(buildInfo.BuildID),
TaskID: uint64(request.Koji.TaskId),