distro/rhel90: compress azure-rhui images
Those images are forced to be 64GiB in size but mostly consist of zeros. This makes them hard to handle, e.g. uploading to brew takes a forever. The vhdPipelines is converted to a function returning the pipelinesFunc and it has a single argument `compress` that will add the compression pipeline bits if `true`. Will return exactly the old pipeline in case of `false`.
This commit is contained in:
parent
5c90abdd0a
commit
921c67cf1b
5 changed files with 90 additions and 29 deletions
|
|
@ -884,7 +884,7 @@ func newDistro(distroName string) distro.Distro {
|
|||
kernelOptions: "ro biosdevname=0 rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0",
|
||||
bootable: true,
|
||||
defaultSize: 4 * GigaByte,
|
||||
pipelines: vhdPipelines,
|
||||
pipelines: vhdPipelines(false),
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "vpc"},
|
||||
exports: []string{"vpc"},
|
||||
|
|
@ -893,8 +893,8 @@ func newDistro(distroName string) distro.Distro {
|
|||
|
||||
azureRhuiImgType := imageType{
|
||||
name: "azure-rhui",
|
||||
filename: "disk.vhd",
|
||||
mimeType: "application/x-vhd",
|
||||
filename: "disk.vhd.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]packageSetFunc{
|
||||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: azureRhuiCommonPackageSet,
|
||||
|
|
@ -1050,10 +1050,10 @@ func newDistro(distroName string) distro.Distro {
|
|||
kernelOptions: "ro console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300",
|
||||
bootable: true,
|
||||
defaultSize: 68719476736,
|
||||
pipelines: vhdPipelines,
|
||||
pipelines: vhdPipelines(true),
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "vpc"},
|
||||
exports: []string{"vpc"},
|
||||
payloadPipelines: []string{"os", "image", "vpc", "archive"},
|
||||
exports: []string{"archive"},
|
||||
basePartitionTables: azureRhuiBasePartitionTables,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ func TestFilenameFromType(t *testing.T) {
|
|||
name: "azure-rhui",
|
||||
args: args{"azure-rhui"},
|
||||
want: wantResult{
|
||||
filename: "disk.vhd",
|
||||
mimeType: "application/x-vhd",
|
||||
filename: "disk.vhd.xz",
|
||||
mimeType: "application/xz",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,29 +52,44 @@ func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, kernelOptions string,
|
|||
return pipeline
|
||||
}
|
||||
|
||||
func vhdPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner))
|
||||
func vhdPipelines(compress bool) pipelinesFunc {
|
||||
return func(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner))
|
||||
|
||||
partitionTable, err := t.getPartitionTable(customizations.GetFilesystems(), options, rng)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
partitionTable, err := t.getPartitionTable(customizations.GetFilesystems(), options, rng)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], customizations, options, partitionTable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pipelines = append(pipelines, *treePipeline)
|
||||
|
||||
diskfile := "disk.img"
|
||||
kernelVer := rpmmd.GetVerStrFromPackageSpecListPanic(packageSetSpecs[osPkgsKey], customizations.GetKernel().Name)
|
||||
imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, partitionTable, t.arch, kernelVer)
|
||||
pipelines = append(pipelines, *imagePipeline)
|
||||
|
||||
var qemufile string
|
||||
if compress {
|
||||
qemufile = "disk.vhd"
|
||||
} else {
|
||||
qemufile = t.filename
|
||||
}
|
||||
|
||||
qemuPipeline := qemuPipeline(imagePipeline.Name, diskfile, qemufile, osbuild.QEMUFormatVPC, nil)
|
||||
pipelines = append(pipelines, *qemuPipeline)
|
||||
|
||||
if compress {
|
||||
lastPipeline := pipelines[len(pipelines)-1]
|
||||
pipelines = append(pipelines, *xzArchivePipeline(lastPipeline.Name, qemufile, t.Filename()))
|
||||
}
|
||||
|
||||
return pipelines, nil
|
||||
}
|
||||
|
||||
treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], customizations, options, partitionTable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pipelines = append(pipelines, *treePipeline)
|
||||
|
||||
diskfile := "disk.img"
|
||||
kernelVer := rpmmd.GetVerStrFromPackageSpecListPanic(packageSetSpecs[osPkgsKey], customizations.GetKernel().Name)
|
||||
imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, partitionTable, t.arch, kernelVer)
|
||||
pipelines = append(pipelines, *imagePipeline)
|
||||
|
||||
qemuPipeline := qemuPipeline(imagePipeline.Name, diskfile, t.filename, osbuild.QEMUFormatVPC, nil)
|
||||
pipelines = append(pipelines, *qemuPipeline)
|
||||
return pipelines, nil
|
||||
}
|
||||
|
||||
func vmdkPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
|
|
|
|||
|
|
@ -3320,6 +3320,29 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "archive",
|
||||
"build": "name:build",
|
||||
"stages": [
|
||||
{
|
||||
"type": "org.osbuild.xz",
|
||||
"inputs": {
|
||||
"file": {
|
||||
"type": "org.osbuild.files",
|
||||
"origin": "org.osbuild.pipeline",
|
||||
"references": {
|
||||
"name:vpc": {
|
||||
"file": "disk.vhd"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"filename": "disk.vhd.xz"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"sources": {
|
||||
|
|
|
|||
|
|
@ -7506,6 +7506,29 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "archive",
|
||||
"build": "name:build",
|
||||
"stages": [
|
||||
{
|
||||
"type": "org.osbuild.xz",
|
||||
"inputs": {
|
||||
"file": {
|
||||
"type": "org.osbuild.files",
|
||||
"origin": "org.osbuild.pipeline",
|
||||
"references": {
|
||||
"name:vpc": {
|
||||
"file": "disk.vhd"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"filename": "disk.vhd.xz"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"sources": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue