image: xz compress a pipeline if the image specifies it

If an image specifies xz compression, add an xz pipeline to the end of
the manifest.
This commit is contained in:
Achilleas Koutsou 2022-11-04 18:56:35 +01:00 committed by Christian Kellner
parent 631b133352
commit 6fed422972

View file

@ -21,6 +21,7 @@ type LiveImage struct {
Environment environment.Environment
Workload workload.Workload
Filename string
Compression string
}
func NewLiveImage() *LiveImage {
@ -47,8 +48,15 @@ func (img *LiveImage) InstantiateManifest(m *manifest.Manifest,
var artifact *artifact.Artifact
switch img.Platform.GetImageFormat() {
case platform.FORMAT_RAW:
imagePipeline.Filename = img.Filename
artifact = imagePipeline.Export()
switch img.Compression {
case "xz":
xzPipeline := manifest.NewXZ(m, buildPipeline, imagePipeline)
xzPipeline.Filename = img.Filename
artifact = xzPipeline.Export()
default:
imagePipeline.Filename = img.Filename
artifact = imagePipeline.Export()
}
case platform.FORMAT_QCOW2:
qcow2Pipeline := manifest.NewQCOW2(m, buildPipeline, imagePipeline)
qcow2Pipeline.Filename = img.Filename