worker: move osbuild exports from OSBuildJob to target
The osbuild export is specific to the upload target and different targets may require using a different export. While osbuild-composer still does not support multiple exports for osbuild jobs, this prepares the ground for such support in the future. The backward compatibility with older implementations of the composer and workers is kept on the JSON (Un)mashaling level, where the JSON message is always a super-set of the old and new way of providing the exports to osbuild job.
This commit is contained in:
parent
4e26ba82d0
commit
776a54135f
11 changed files with 363 additions and 38 deletions
|
|
@ -225,17 +225,19 @@ func TestArgs(t *testing.T) {
|
|||
|
||||
job := worker.OSBuildJob{
|
||||
Manifest: manifest,
|
||||
Exports: []string{"assembler"},
|
||||
PipelineNames: &worker.PipelineNames{
|
||||
Build: []string{"b"},
|
||||
Payload: []string{"x", "y", "z"},
|
||||
},
|
||||
Targets: []*target.Target{
|
||||
{
|
||||
Name: target.TargetNameWorkerServer,
|
||||
ImageName: "test-image",
|
||||
ExportFilename: "test-image",
|
||||
Options: &target.WorkerServerTargetOptions{},
|
||||
Name: target.TargetNameWorkerServer,
|
||||
ImageName: "test-image",
|
||||
OsbuildArtifact: target.OsbuildArtifact{
|
||||
ExportFilename: "test-image",
|
||||
ExportName: "assembler",
|
||||
},
|
||||
Options: &target.WorkerServerTargetOptions{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -409,13 +411,15 @@ func TestMixedOSBuildJob(t *testing.T) {
|
|||
|
||||
oldJob := worker.OSBuildJob{
|
||||
Manifest: emptyManifestV2,
|
||||
Exports: []string{"assembler"},
|
||||
Targets: []*target.Target{
|
||||
{
|
||||
Name: target.TargetNameWorkerServer,
|
||||
ImageName: "no-pipeline-names",
|
||||
ExportFilename: "no-pipeline-names",
|
||||
Options: &target.WorkerServerTargetOptions{},
|
||||
Name: target.TargetNameWorkerServer,
|
||||
ImageName: "no-pipeline-names",
|
||||
OsbuildArtifact: target.OsbuildArtifact{
|
||||
ExportFilename: "no-pipeline-names",
|
||||
ExportName: "assembler",
|
||||
},
|
||||
Options: &target.WorkerServerTargetOptions{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -424,17 +428,19 @@ func TestMixedOSBuildJob(t *testing.T) {
|
|||
|
||||
newJob := worker.OSBuildJob{
|
||||
Manifest: emptyManifestV2,
|
||||
Exports: []string{"assembler"},
|
||||
PipelineNames: &worker.PipelineNames{
|
||||
Build: []string{"build"},
|
||||
Payload: []string{"other", "pipelines"},
|
||||
},
|
||||
Targets: []*target.Target{
|
||||
{
|
||||
Name: target.TargetNameWorkerServer,
|
||||
ImageName: "with-pipeline-names",
|
||||
ExportFilename: "with-pipeline-names",
|
||||
Options: &target.WorkerServerTargetOptions{},
|
||||
Name: target.TargetNameWorkerServer,
|
||||
ImageName: "with-pipeline-names",
|
||||
OsbuildArtifact: target.OsbuildArtifact{
|
||||
ExportFilename: "with-pipeline-names",
|
||||
ExportName: "assembler",
|
||||
},
|
||||
Options: &target.WorkerServerTargetOptions{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue