From c7aecdf31c39fa3d403caade835691d85574bd4c Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Thu, 27 Apr 2023 16:33:01 +0200 Subject: [PATCH] distro: delete distro.Manifest type Delete the distro.Manifest type and its tests. Change all occurrences of distro.Manifest to manifest.OSBuildManifest. --- cmd/gen-manifests/main.go | 11 +-- cmd/osbuild-store-dump/main.go | 3 +- internal/cloudapi/v2/handler.go | 17 ++-- internal/distro/distro.go | 41 +--------- internal/distro/distro_test.go | 78 ------------------- .../distro_test_common/distro_test_common.go | 3 +- internal/distro/fedora/imagetype.go | 6 +- internal/distro/rhel7/imagetype.go | 6 +- internal/distro/rhel8/imagetype.go | 6 +- internal/distro/rhel9/imagetype.go | 6 +- internal/distro/test_distro/distro.go | 3 +- internal/store/compose.go | 3 +- internal/store/json.go | 19 ++--- internal/store/store.go | 5 +- internal/store/store_test.go | 3 +- internal/worker/json.go | 7 +- internal/worker/server_test.go | 3 +- 17 files changed, 58 insertions(+), 162 deletions(-) diff --git a/cmd/gen-manifests/main.go b/cmd/gen-manifests/main.go index b12187c80..a3aa752dd 100644 --- a/cmd/gen-manifests/main.go +++ b/cmd/gen-manifests/main.go @@ -21,6 +21,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/distroregistry" "github.com/osbuild/osbuild-composer/internal/dnfjson" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/rpmmd" ) @@ -167,7 +168,7 @@ func makeManifestJob(name string, imgType distro.ImageType, cr composeRequest, d err = fmt.Errorf("[%s] nil package specs", filename) return } - manifest, _, err := imgType.Manifest(cr.Blueprint.Customizations, options, repos, packageSpecs, containerSpecs, seedArg) + mf, _, err := imgType.Manifest(cr.Blueprint.Customizations, options, repos, packageSpecs, containerSpecs, seedArg) if err != nil { err = fmt.Errorf("[%s] failed: %s", filename, err) return @@ -181,7 +182,7 @@ func makeManifestJob(name string, imgType distro.ImageType, cr composeRequest, d Blueprint: cr.Blueprint, OSTree: cr.OSTree, } - err = save(manifest, packageSpecs, containerSpecs, request, path, filename) + err = save(mf, packageSpecs, containerSpecs, request, path, filename) return } return job @@ -268,15 +269,15 @@ func depsolve(cacheDir string, imageType distro.ImageType, bp blueprint.Blueprin return depsolvedSets, nil } -func save(manifest distro.Manifest, pkgs map[string][]rpmmd.PackageSpec, containers []container.Spec, cr composeRequest, path, filename string) error { +func save(mf manifest.OSBuildManifest, pkgs map[string][]rpmmd.PackageSpec, containers []container.Spec, cr composeRequest, path, filename string) error { data := struct { ComposeRequest composeRequest `json:"compose-request"` - Manifest distro.Manifest `json:"manifest"` + Manifest manifest.OSBuildManifest `json:"manifest"` RPMMD map[string][]rpmmd.PackageSpec `json:"rpmmd"` Containers []container.Spec `json:"containers,omitempty"` NoImageInfo bool `json:"no-image-info"` }{ - cr, manifest, pkgs, containers, true, + cr, mf, pkgs, containers, true, } b, err := json.MarshalIndent(data, "", " ") if err != nil { diff --git a/cmd/osbuild-store-dump/main.go b/cmd/osbuild-store-dump/main.go index 2f3201d9e..a251a8665 100644 --- a/cmd/osbuild-store-dump/main.go +++ b/cmd/osbuild-store-dump/main.go @@ -14,13 +14,14 @@ import ( "github.com/osbuild/osbuild-composer/internal/distro/fedora" "github.com/osbuild/osbuild-composer/internal/distroregistry" "github.com/osbuild/osbuild-composer/internal/dnfjson" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/store" "github.com/osbuild/osbuild-composer/internal/target" ) -func getManifest(bp blueprint.Blueprint, t distro.ImageType, a distro.Arch, d distro.Distro, cacheDir string, repos []rpmmd.RepoConfig) (distro.Manifest, []rpmmd.PackageSpec) { +func getManifest(bp blueprint.Blueprint, t distro.ImageType, a distro.Arch, d distro.Distro, cacheDir string, repos []rpmmd.RepoConfig) (manifest.OSBuildManifest, []rpmmd.PackageSpec) { packageSets := t.PackageSets(bp, distro.ImageOptions{}, repos) pkgSpecSets := make(map[string][]rpmmd.PackageSpec) solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), a.Name(), d.Name(), cacheDir) diff --git a/internal/cloudapi/v2/handler.go b/internal/cloudapi/v2/handler.go index 9bfac988f..d52d4cb7f 100644 --- a/internal/cloudapi/v2/handler.go +++ b/internal/cloudapi/v2/handler.go @@ -18,6 +18,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/common" "github.com/osbuild/osbuild-composer/internal/distro" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/ostree" "github.com/osbuild/osbuild-composer/internal/rpmmd" @@ -1325,7 +1326,7 @@ func (h *apiHandlers) getComposeManifestsImpl(ctx echo.Context, id string) error return HTTPErrorWithInternal(ErrorComposeNotFound, err) } - var manifest distro.Manifest + var mf manifest.OSBuildManifest switch buildJobType { case worker.JobTypeOSBuild: @@ -1336,7 +1337,7 @@ func (h *apiHandlers) getComposeManifestsImpl(ctx echo.Context, id string) error } if len(buildJob.Manifest) != 0 { - manifest = buildJob.Manifest + mf = buildJob.Manifest } else { buildInfo, err := h.server.workers.OSBuildJobInfo(finalizeInfo.Deps[i], &worker.OSBuildJobResult{}) if err != nil { @@ -1346,14 +1347,14 @@ func (h *apiHandlers) getComposeManifestsImpl(ctx echo.Context, id string) error if err != nil { return HTTPErrorWithInternal(ErrorComposeNotFound, fmt.Errorf("job %q: %v", jobId, err)) } - manifest = manifestResult.Manifest + mf = manifestResult.Manifest } default: return HTTPErrorWithInternal(ErrorInvalidJobType, fmt.Errorf("unexpected job type in koji compose dependencies: %q", buildJobType)) } - manifestBlobs = append(manifestBlobs, manifest) + manifestBlobs = append(manifestBlobs, mf) } case worker.JobTypeOSBuild: @@ -1363,9 +1364,9 @@ func (h *apiHandlers) getComposeManifestsImpl(ctx echo.Context, id string) error return HTTPErrorWithInternal(ErrorComposeNotFound, err) } - var manifest distro.Manifest + var mf manifest.OSBuildManifest if len(buildJob.Manifest) != 0 { - manifest = buildJob.Manifest + mf = buildJob.Manifest } else { buildInfo, err := h.server.workers.OSBuildJobInfo(jobId, &worker.OSBuildJobResult{}) if err != nil { @@ -1375,9 +1376,9 @@ func (h *apiHandlers) getComposeManifestsImpl(ctx echo.Context, id string) error if err != nil { return HTTPErrorWithInternal(ErrorComposeNotFound, fmt.Errorf("job %q: %v", jobId, err)) } - manifest = manifestResult.Manifest + mf = manifestResult.Manifest } - manifestBlobs = append(manifestBlobs, manifest) + manifestBlobs = append(manifestBlobs, mf) default: return HTTPError(ErrorInvalidJobType) diff --git a/internal/distro/distro.go b/internal/distro/distro.go index 0b38be14f..1bcd31ae5 100644 --- a/internal/distro/distro.go +++ b/internal/distro/distro.go @@ -1,12 +1,12 @@ package distro import ( - "encoding/json" "fmt" "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/container" "github.com/osbuild/osbuild-composer/internal/disk" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/subscription" ) @@ -131,7 +131,7 @@ type ImageType interface { // specified in the given blueprint; it also returns any warnings (e.g. // deprecation notices) generated by the manifest. // The packageSpecSets must be labelled in the same way as the originating PackageSets. - Manifest(b *blueprint.Customizations, options ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (Manifest, []string, error) + Manifest(b *blueprint.Customizations, options ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (manifest.OSBuildManifest, []string, error) } // The ImageOptions specify options for a specific image build @@ -176,43 +176,6 @@ type FactsImageOptions struct { type BasePartitionTableMap map[string]disk.PartitionTable -// A Manifest is an opaque JSON object, which is a valid input to osbuild -type Manifest []byte - -func (m Manifest) MarshalJSON() ([]byte, error) { - return json.RawMessage(m).MarshalJSON() -} - -func (m *Manifest) UnmarshalJSON(payload []byte) error { - var raw json.RawMessage - err := (&raw).UnmarshalJSON(payload) - if err != nil { - return err - } - *m = Manifest(raw) - return nil -} - -type manifestVersion struct { - Version string `json:"version"` -} - -func (m Manifest) Version() (string, error) { - mver := new(manifestVersion) - if err := json.Unmarshal(m, mver); err != nil { - return "", err - } - - switch mver.Version { - case "": - return "1", nil - case "2": - return "2", nil - default: - return "", fmt.Errorf("Unsupported Manifest version %s", mver.Version) - } -} - // Fallbacks: When a new method is added to an interface to provide to provide // information that isn't available for older implementations, the older // methods should return a fallback/default value by calling the appropriate diff --git a/internal/distro/distro_test.go b/internal/distro/distro_test.go index 7afc2fdc8..abd2279ec 100644 --- a/internal/distro/distro_test.go +++ b/internal/distro/distro_test.go @@ -30,84 +30,6 @@ func TestDistro_Manifest(t *testing.T) { ) } -var ( - v1manifests = []string{ - `{}`, - ` -{ - "sources": { - "org.osbuild.files": { - "urls": {} - } - }, - "pipeline": { - "build": { - "pipeline": { - "stages": [] - }, - "runner": "org.osbuild.rhel84" - }, - "stages": [], - "assembler": { - "name": "org.osbuild.qemu", - "options": {} - } - } -}`, - } - - v2manifests = []string{ - `{"version": "2"}`, - ` -{ - "version": "2", - "pipelines": [ - { - "name": "build", - "runner": "org.osbuild.rhel84", - "stages": [] - } - ], - "sources": { - "org.osbuild.curl": { - "items": {} - } - } -}`, - } -) - -func TestDistro_Version(t *testing.T) { - require := require.New(t) - expectedVersion := "1" - for idx, rawManifest := range v1manifests { - manifest := distro.Manifest(rawManifest) - detectedVersion, err := manifest.Version() - require.NoError(err, "Could not detect Manifest version for %d: %v", idx, err) - require.Equal(expectedVersion, detectedVersion, "in manifest %d", idx) - } - - expectedVersion = "2" - for idx, rawManifest := range v2manifests { - manifest := distro.Manifest(rawManifest) - detectedVersion, err := manifest.Version() - require.NoError(err, "Could not detect Manifest version for %d: %v", idx, err) - require.Equal(expectedVersion, detectedVersion, "in manifest %d", idx) - } - - { - manifest := distro.Manifest("") - _, err := manifest.Version() - require.Error(err, "Empty manifest did not return an error") - } - - { - manifest := distro.Manifest("{") - _, err := manifest.Version() - require.Error(err, "Invalid manifest did not return an error") - } -} - // Ensure that all package sets defined in the package set chains are defined for the image type func TestImageType_PackageSetsChains(t *testing.T) { distros := distroregistry.NewDefault() diff --git a/internal/distro/distro_test_common/distro_test_common.go b/internal/distro/distro_test_common/distro_test_common.go index 759c5d37c..b31fd7a00 100644 --- a/internal/distro/distro_test_common/distro_test_common.go +++ b/internal/distro/distro_test_common/distro_test_common.go @@ -18,6 +18,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/distroregistry" "github.com/osbuild/osbuild-composer/internal/dnfjson" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/ostree" "github.com/osbuild/osbuild-composer/internal/rpmmd" ) @@ -49,7 +50,7 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis var tt struct { ComposeRequest *composeRequest `json:"compose-request"` PackageSpecSets map[string][]rpmmd.PackageSpec `json:"rpmmd"` - Manifest distro.Manifest `json:"manifest,omitempty"` + Manifest manifest.OSBuildManifest `json:"manifest,omitempty"` Containers []container.Spec `json:"containers,omitempty"` } file, err := os.ReadFile(fileName) diff --git a/internal/distro/fedora/imagetype.go b/internal/distro/fedora/imagetype.go index 93c25417d..ef2e13d39 100644 --- a/internal/distro/fedora/imagetype.go +++ b/internal/distro/fedora/imagetype.go @@ -257,7 +257,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, repos []rpmmd.RepoConfig, packageSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, - seed int64) (distro.Manifest, []string, error) { + seed int64) (manifest.OSBuildManifest, []string, error) { bp := &blueprint.Blueprint{Name: "empty blueprint"} err := bp.Initialize() @@ -321,9 +321,9 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, ret, err := manifest.Serialize(packageSpecs) if err != nil { - return distro.Manifest(ret), nil, err + return ret, nil, err } - return distro.Manifest(ret), warnings, err + return ret, warnings, err } // checkOptions checks the validity and compatibility of options and customizations for the image type. diff --git a/internal/distro/rhel7/imagetype.go b/internal/distro/rhel7/imagetype.go index 3cebee99a..e4e771533 100644 --- a/internal/distro/rhel7/imagetype.go +++ b/internal/distro/rhel7/imagetype.go @@ -154,7 +154,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, repos []rpmmd.RepoConfig, packageSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, - seed int64) (distro.Manifest, []string, error) { + seed int64) (manifest.OSBuildManifest, []string, error) { bp := &blueprint.Blueprint{Name: "empty blueprint"} err := bp.Initialize() @@ -223,9 +223,9 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, ret, err := manifest.Serialize(packageSpecs) if err != nil { - return distro.Manifest(ret), nil, err + return ret, nil, err } - return distro.Manifest(ret), warnings, err + return ret, warnings, err } func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig) map[string][]rpmmd.PackageSet { diff --git a/internal/distro/rhel8/imagetype.go b/internal/distro/rhel8/imagetype.go index 9f56d819e..c7a94af30 100644 --- a/internal/distro/rhel8/imagetype.go +++ b/internal/distro/rhel8/imagetype.go @@ -187,7 +187,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, repos []rpmmd.RepoConfig, packageSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, - seed int64) (distro.Manifest, []string, error) { + seed int64) (manifest.OSBuildManifest, []string, error) { bp := &blueprint.Blueprint{Name: "empty blueprint"} err := bp.Initialize() @@ -256,9 +256,9 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, ret, err := manifest.Serialize(packageSpecs) if err != nil { - return distro.Manifest(ret), nil, err + return ret, nil, err } - return distro.Manifest(ret), warnings, err + return ret, warnings, err } func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig) map[string][]rpmmd.PackageSet { diff --git a/internal/distro/rhel9/imagetype.go b/internal/distro/rhel9/imagetype.go index 33b30ad50..b84b74a95 100644 --- a/internal/distro/rhel9/imagetype.go +++ b/internal/distro/rhel9/imagetype.go @@ -190,7 +190,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, repos []rpmmd.RepoConfig, packageSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, - seed int64) (distro.Manifest, []string, error) { + seed int64) (manifest.OSBuildManifest, []string, error) { bp := &blueprint.Blueprint{Name: "empty blueprint"} err := bp.Initialize() @@ -256,9 +256,9 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, ret, err := manifest.Serialize(packageSpecs) if err != nil { - return distro.Manifest(ret), nil, err + return ret, nil, err } - return distro.Manifest(ret), warnings, err + return ret, warnings, err } func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig) map[string][]rpmmd.PackageSet { diff --git a/internal/distro/test_distro/distro.go b/internal/distro/test_distro/distro.go index f20a5f719..b943c474b 100644 --- a/internal/distro/test_distro/distro.go +++ b/internal/distro/test_distro/distro.go @@ -10,6 +10,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/container" "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/distroregistry" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/rpmmd" ) @@ -243,7 +244,7 @@ func (t *TestImageType) Exports() []string { return distro.ExportsFallback() } -func (t *TestImageType) Manifest(b *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (distro.Manifest, []string, error) { +func (t *TestImageType) Manifest(b *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (manifest.OSBuildManifest, []string, error) { mountpoints := b.GetFilesystems() invalidMountpoints := []string{} diff --git a/internal/store/compose.go b/internal/store/compose.go index 76d00fb8d..e3b53dfd8 100644 --- a/internal/store/compose.go +++ b/internal/store/compose.go @@ -7,6 +7,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/common" "github.com/osbuild/osbuild-composer/internal/distro" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/target" ) @@ -23,7 +24,7 @@ func (ste *StateTransitionError) Error() string { type ImageBuild struct { ID int ImageType distro.ImageType - Manifest distro.Manifest + Manifest manifest.OSBuildManifest Targets []*target.Target JobCreated time.Time JobStarted time.Time diff --git a/internal/store/json.go b/internal/store/json.go index 3ee4a86da..08e0485c7 100644 --- a/internal/store/json.go +++ b/internal/store/json.go @@ -12,6 +12,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/common" "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/distroregistry" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/target" ) @@ -41,15 +42,15 @@ type composesV0 map[uuid.UUID]composeV0 // ImageBuild represents a single image build inside a compose type imageBuildV0 struct { - ID int `json:"id"` - ImageType string `json:"image_type"` - Manifest distro.Manifest `json:"manifest"` - Targets []*target.Target `json:"targets"` - JobCreated time.Time `json:"job_created"` - JobStarted time.Time `json:"job_started"` - JobFinished time.Time `json:"job_finished"` - Size uint64 `json:"size"` - JobID uuid.UUID `json:"jobid,omitempty"` + ID int `json:"id"` + ImageType string `json:"image_type"` + Manifest manifest.OSBuildManifest `json:"manifest"` + Targets []*target.Target `json:"targets"` + JobCreated time.Time `json:"job_created"` + JobStarted time.Time `json:"job_started"` + JobFinished time.Time `json:"job_finished"` + Size uint64 `json:"size"` + JobID uuid.UUID `json:"jobid,omitempty"` // Kept for backwards compatibility. Image builds which were done // before the move to the job queue use this to store whether they diff --git a/internal/store/store.go b/internal/store/store.go index 65362a4ae..248dbeb6f 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -19,6 +19,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/jsondb" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/common" @@ -365,7 +366,7 @@ func (s *Store) GetAllComposes() map[uuid.UUID]Compose { } func (s *Store) PushCompose(composeID uuid.UUID, - manifest distro.Manifest, + manifest manifest.OSBuildManifest, imageType distro.ImageType, bp *blueprint.Blueprint, size uint64, @@ -404,7 +405,7 @@ func (s *Store) PushCompose(composeID uuid.UUID, // Set testSuccess to create a fake successful compose, otherwise it will create a failed compose // It does not actually run a compose job func (s *Store) PushTestCompose(composeID uuid.UUID, - manifest distro.Manifest, + manifest manifest.OSBuildManifest, imageType distro.ImageType, bp *blueprint.Blueprint, size uint64, diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 658555d09..50601730d 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -11,6 +11,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/common" "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/distro/test_distro" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/target" @@ -34,7 +35,7 @@ type storeTest struct { myDistro *test_distro.TestDistro myArch distro.Arch myImageType distro.ImageType - myManifest distro.Manifest + myManifest manifest.OSBuildManifest myRepoConfig []rpmmd.RepoConfig myPackageSpec []rpmmd.PackageSpec myImageOptions distro.ImageOptions diff --git a/internal/worker/json.go b/internal/worker/json.go index 9c5268451..d22f51da6 100644 --- a/internal/worker/json.go +++ b/internal/worker/json.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/osbuild/osbuild-composer/internal/distro" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/target" @@ -16,7 +17,7 @@ import ( // type OSBuildJob struct { - Manifest distro.Manifest `json:"manifest,omitempty"` + Manifest manifest.OSBuildManifest `json:"manifest,omitempty"` // Index of the ManifestJobByIDResult instance in the job's dynamic arguments slice ManifestDynArgsIdx *int `json:"manifest_dyn_args_idx,omitempty"` Targets []*target.Target `json:"targets,omitempty"` @@ -243,8 +244,8 @@ type DepsolveJobResult struct { type ManifestJobByID struct{} type ManifestJobByIDResult struct { - Manifest distro.Manifest `json:"data,omitempty"` - Error string `json:"error"` + Manifest manifest.OSBuildManifest `json:"data,omitempty"` + Error string `json:"error"` JobResult } diff --git a/internal/worker/server_test.go b/internal/worker/server_test.go index 9fcdf1237..655b65cf4 100644 --- a/internal/worker/server_test.go +++ b/internal/worker/server_test.go @@ -19,6 +19,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/distro" "github.com/osbuild/osbuild-composer/internal/distro/test_distro" "github.com/osbuild/osbuild-composer/internal/jobqueue/fsjobqueue" + "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/rpmmd" @@ -409,7 +410,7 @@ func TestRequestJobById(t *testing.T) { func TestMixedOSBuildJob(t *testing.T) { require := require.New(t) - emptyManifestV2 := distro.Manifest(`{"version":"2","pipelines":{}}`) + emptyManifestV2 := manifest.OSBuildManifest(`{"version":"2","pipelines":{}}`) server := newTestServer(t, t.TempDir(), time.Millisecond*10, "/", false) fbPipelines := &worker.PipelineNames{Build: distro.BuildPipelinesFallback(), Payload: distro.PayloadPipelinesFallback()}