worker: introduce dynamicArgs

In addition to the arguments passed when scheduling a job, a job now
also takes the results of its dependencies as additional arguments. We
call these dynamic arguments for the lack of a better term.

The immediate use-case for this is to allow koji jobs to be split up
as follows:
 - koji-init: Creates a koji build, and returns us a token.
 - osbuild-koji: one job per architecture, depending on koji-init
   having succeeded. Builds the image, and uploads it to koji,
   returning metadata about the image produced.
 - koji-finalize: uses the token from koji-init and the metadata
   from osbuild-koji to import the build into koji if it succeeded
   or mark it as failed if it failed.
This commit is contained in:
Tom Gundersen 2020-11-06 17:06:36 +00:00 committed by Lars Karlitski
parent 11d0da0b5c
commit a2895376ae
5 changed files with 26 additions and 12 deletions

View file

@ -90,11 +90,12 @@ func TestCancel(t *testing.T) {
jobId, err := server.Enqueue(arch.Name(), &worker.OSBuildJob{Manifest: manifest})
require.NoError(t, err)
token, j, typ, args, err := server.RequestJob(context.Background(), arch.Name(), []string{"osbuild"})
token, j, typ, args, dynamicArgs, err := server.RequestJob(context.Background(), arch.Name(), []string{"osbuild"})
require.NoError(t, err)
require.Equal(t, jobId, j)
require.Equal(t, "osbuild", typ)
require.NotNil(t, args)
require.Nil(t, dynamicArgs)
err = server.Cancel(jobId)
require.NoError(t, err)