image: handle the GCE format in the live image

Add the options required by GCE to a tar pipeline at the end of the
manifest for images defined on the GCE format.
This commit is contained in:
Achilleas Koutsou 2022-11-07 17:55:00 +01:00 committed by Christian Kellner
parent 8c361e510d
commit f0e29ab697

View file

@ -4,9 +4,11 @@ import (
"math/rand"
"github.com/osbuild/osbuild-composer/internal/artifact"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/disk"
"github.com/osbuild/osbuild-composer/internal/environment"
"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"
"github.com/osbuild/osbuild-composer/internal/runner"
@ -76,6 +78,15 @@ func (img *LiveImage) InstantiateManifest(m *manifest.Manifest,
}
artifactPipeline = vmdkPipeline
artifact = vmdkPipeline.Export()
case platform.FORMAT_GCE:
archivePipeline := manifest.NewTar(m, buildPipeline, imagePipeline, "archive")
archivePipeline.Format = osbuild.TarArchiveFormatOldgnu
archivePipeline.RootNode = osbuild.TarRootNodeOmit
// these are required to successfully import the image to GCP
archivePipeline.ACLs = common.BoolToPtr(false)
archivePipeline.SELinux = common.BoolToPtr(false)
archivePipeline.Xattrs = common.BoolToPtr(false)
archivePipeline.Filename = img.Filename // filename extension will determine compression
default:
panic("invalid image format for image kind")
}