From 8fa3f6cc5cb095489cad232c7b3db4111eb444ca Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Wed, 11 Jan 2023 18:45:45 +0100 Subject: [PATCH] distro/rhel8: update tar image to new definitions --- internal/distro/rhel8/bare_metal.go | 7 +++---- internal/distro/rhel8/images.go | 20 ++++++++++++++++++++ internal/distro/rhel8/pipelines.go | 14 -------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/internal/distro/rhel8/bare_metal.go b/internal/distro/rhel8/bare_metal.go index ef6ed15fc..d1fc54d2d 100644 --- a/internal/distro/rhel8/bare_metal.go +++ b/internal/distro/rhel8/bare_metal.go @@ -36,7 +36,6 @@ func tarImgType() imageType { filename: "root.tar.xz", mimeType: "application/x-tar", packageSets: map[string]packageSetFunc{ - buildPkgsKey: distroBuildPackageSet, osPkgsKey: func(t *imageType) rpmmd.PackageSet { return rpmmd.PackageSet{ Include: []string{"policycoreutils", "selinux-policy-targeted"}, @@ -47,10 +46,10 @@ func tarImgType() imageType { packageSetChains: map[string][]string{ osPkgsKey: {osPkgsKey, blueprintPkgsKey}, }, - pipelines: tarPipelines, + image: tarImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"os", "root-tar"}, - exports: []string{"root-tar"}, + payloadPipelines: []string{"os", "archive"}, + exports: []string{"archive"}, } } diff --git a/internal/distro/rhel8/images.go b/internal/distro/rhel8/images.go index 1c53f0366..8d6299a47 100644 --- a/internal/distro/rhel8/images.go +++ b/internal/distro/rhel8/images.go @@ -197,3 +197,23 @@ func liveImage(workload workload.Workload, return img, nil } + +func tarImage(workload workload.Workload, + t *imageType, + customizations *blueprint.Customizations, + options distro.ImageOptions, + packageSets map[string]rpmmd.PackageSet, + containers []container.Spec, + rng *rand.Rand) (image.ImageKind, error) { + + img := image.NewArchive() + img.Platform = t.platform + img.OSCustomizations = osCustomizations(t, packageSets[osPkgsKey], options, containers, customizations) + img.Environment = t.environment + img.Workload = workload + + img.Filename = t.Filename() + + return img, nil + +} diff --git a/internal/distro/rhel8/pipelines.go b/internal/distro/rhel8/pipelines.go index 7623c8f9d..21e4d0397 100644 --- a/internal/distro/rhel8/pipelines.go +++ b/internal/distro/rhel8/pipelines.go @@ -28,20 +28,6 @@ func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *dis return pipeline } -func tarPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, rng *rand.Rand) ([]osbuild.Pipeline, error) { - pipelines := make([]osbuild.Pipeline, 0) - pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner.String())) - - treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], containers, customizations, options, nil) - if err != nil { - return nil, err - } - pipelines = append(pipelines, *treePipeline) - tarPipeline := tarArchivePipeline("root-tar", treePipeline.Name, &osbuild.TarStageOptions{Filename: "root.tar.xz"}) - pipelines = append(pipelines, *tarPipeline) - return pipelines, nil -} - // makeISORootPath return a path that can be used to address files and folders in // the root of the iso func makeISORootPath(p string) string {