distro/rhel85: add image and qcow pipelines

Live image pipeline: Creates the live image in a file through a loopback
device.

Stages:
- truncate: create the file to hold the image
- sfdisk: partition the device
- mkfs.fat, mkfs.xfs: create the filesystems
- copy: copy the tree from the previous pipeline (the OS pipeline) into
  the directories where the partitions are mounted
- grub2.inst: install the bootloader

QEMU pipeline: Convert the live image from the previous pipeline to a
qcow2 image.
This commit is contained in:
Achilleas Koutsou 2021-07-06 19:37:41 +02:00 committed by Ondřej Budai
parent 6debb62758
commit dec74dba32
5 changed files with 338 additions and 1 deletions

View file

@ -0,0 +1,48 @@
package osbuild2
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewQemukStage(t *testing.T) {
formatOptionsList := []QEMUFormatOptions{
Qcow2Options{
Type: "qcow2",
Compat: "0.10",
},
VPCOptions{
Type: "vpc",
},
VMDKOptions{
Type: "vmdk",
},
}
input := new(QEMUStageInput)
input.Type = "org.osbuild.files"
input.Origin = "org.osbuild.pipeline"
input.References = map[string]QEMUFile{
"name:stage": {
File: "img.raw",
},
}
inputs := QEMUStageInputs{Image: input}
for _, format := range formatOptionsList {
options := QEMUStageOptions{
Filename: "img.out",
Format: format,
}
expectedStage := &Stage{
Type: "org.osbuild.qemu",
Options: &options,
Inputs: &inputs,
}
actualStage := NewQEMUStage(&options, &inputs)
assert.Equal(t, expectedStage, actualStage)
}
}

View file

@ -0,0 +1,37 @@
package osbuild2
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewSfdiskStage(t *testing.T) {
partition := Partition{
Bootable: true,
Name: "root",
Size: 2097152,
Start: 0,
Type: "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
UUID: "68B2905B-DF3E-4FB3-80FA-49D1E773AA33",
}
options := SfdiskStageOptions{
Label: "gpt",
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
Partitions: []Partition{partition},
}
device := NewLoopbackDevice(&LoopbackDeviceOptions{Filename: "disk.raw"})
devices := SfdiskStageDevices{*device}
expectedStage := &Stage{
Type: "org.osbuild.sfdisk",
Options: &options,
Devices: &devices,
}
actualStage := NewSfdiskStage(&options, &devices)
assert.Equal(t, expectedStage, actualStage)
}