blueprint: generate real f30 images for all the output types
This is still just a placeholder, and in particular the live CD support is not right. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
4845826048
commit
22254637f8
11 changed files with 166 additions and 63 deletions
|
|
@ -5,13 +5,11 @@ import "osbuild-composer/internal/pipeline"
|
|||
type amiOutput struct{}
|
||||
|
||||
func (t *amiOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "qcow2",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30FSTabStage(p)
|
||||
addF30GRUB2Stage(p)
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "qcow2", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import "osbuild-composer/internal/pipeline"
|
|||
type diskOutput struct{}
|
||||
|
||||
func (t *diskOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "raw",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30FSTabStage(p)
|
||||
addF30GRUB2Stage(p)
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "raw", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,9 @@ import "osbuild-composer/internal/pipeline"
|
|||
type ext4Output struct{}
|
||||
|
||||
func (t *ext4Output) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "raw",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30SELinuxStage(p)
|
||||
addF30RawFSAssembler(p, t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
125
internal/blueprint/f30_helpers.go
Normal file
125
internal/blueprint/f30_helpers.go
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
package blueprint
|
||||
|
||||
import (
|
||||
"osbuild-composer/internal/pipeline"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func getF30Repository() *pipeline.DNFRepository {
|
||||
repo := pipeline.NewDNFRepository("https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch", "", "")
|
||||
repo.SetChecksum("sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97")
|
||||
repo.SetGPGKey("F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9")
|
||||
return repo
|
||||
}
|
||||
|
||||
func getF30BuildPipeline() *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
options := &pipeline.DNFStageOptions{
|
||||
ReleaseVersion: "30",
|
||||
BaseArchitecture: "x86_64",
|
||||
}
|
||||
options.AddRepository(getF30Repository())
|
||||
options.AddPackage("dnf")
|
||||
options.AddPackage("e2fsprogs")
|
||||
options.AddPackage("policycoreutils")
|
||||
options.AddPackage("qemu-img")
|
||||
options.AddPackage("systemd")
|
||||
options.AddPackage("grub2-pc")
|
||||
options.AddPackage("tar")
|
||||
p.AddStage(pipeline.NewDNFStage(options))
|
||||
return p
|
||||
}
|
||||
|
||||
func getF30Pipeline() *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{
|
||||
BuildPipeline: getF30BuildPipeline(),
|
||||
}
|
||||
options := &pipeline.DNFStageOptions{
|
||||
ReleaseVersion: "30",
|
||||
BaseArchitecture: "x86_64",
|
||||
}
|
||||
options.AddRepository(getF30Repository())
|
||||
options.AddPackage("@Core")
|
||||
options.AddPackage("chrony")
|
||||
options.AddPackage("kernel")
|
||||
options.AddPackage("selinux-policy-targeted")
|
||||
options.AddPackage("grub2-pc")
|
||||
options.AddPackage("spice-vdagent")
|
||||
options.AddPackage("qemu-guest-agent")
|
||||
options.AddPackage("xen-libs")
|
||||
options.AddPackage("langpacks-en")
|
||||
p.AddStage(pipeline.NewDNFStage(options))
|
||||
p.AddStage(pipeline.NewFixBLSStage())
|
||||
p.AddStage(pipeline.NewLocaleStage(
|
||||
&pipeline.LocaleStageOptions{
|
||||
Language: "en_US",
|
||||
}))
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func addF30GRUB2Stage(p *pipeline.Pipeline) {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
p.AddStage(pipeline.NewGRUB2Stage(
|
||||
&pipeline.GRUB2StageOptions{
|
||||
RootFilesystemUUID: id,
|
||||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
func addF30FSTabStage(p *pipeline.Pipeline) {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
options := &pipeline.FSTabStageOptions{}
|
||||
options.AddFilesystem(id, "extf4", "/", "defaults", 1, 1)
|
||||
p.AddStage(pipeline.NewFSTabStage(options))
|
||||
}
|
||||
|
||||
func addF30SELinuxStage(p *pipeline.Pipeline) {
|
||||
p.AddStage(pipeline.NewSELinuxStage(
|
||||
&pipeline.SELinuxStageOptions{
|
||||
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
|
||||
}))
|
||||
}
|
||||
|
||||
func addF30QemuAssembler(p *pipeline.Pipeline, format string, filename string) {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
p.Assembler = pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
PTUUID: "0x14fc63d2",
|
||||
RootFilesystemUUDI: id,
|
||||
Size: 3221225472,
|
||||
})
|
||||
}
|
||||
|
||||
func addF30TarAssembler(p *pipeline.Pipeline, filename string) {
|
||||
p.Assembler = pipeline.NewTarAssembler(
|
||||
&pipeline.TarAssemblerOptions{
|
||||
Filename: filename,
|
||||
})
|
||||
}
|
||||
|
||||
func addF30RawFSAssembler(p *pipeline.Pipeline, filename string) {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
p.Assembler = pipeline.NewRawFSAssembler(
|
||||
&pipeline.RawFSAssemblerOptions{
|
||||
Filename: filename,
|
||||
RootFilesystemUUDI: id,
|
||||
Size: 3221225472,
|
||||
})
|
||||
}
|
||||
|
|
@ -5,13 +5,10 @@ import "osbuild-composer/internal/pipeline"
|
|||
type liveIsoOutput struct{}
|
||||
|
||||
func (t *liveIsoOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "raw",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
// TODO!
|
||||
p := getF30Pipeline()
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "raw", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import "osbuild-composer/internal/pipeline"
|
|||
type openstackOutput struct{}
|
||||
|
||||
func (t *openstackOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "qcow2",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30FSTabStage(p)
|
||||
addF30GRUB2Stage(p)
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "qcow2", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import "osbuild-composer/internal/pipeline"
|
|||
type qcow2Output struct{}
|
||||
|
||||
func (t *qcow2Output) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "qcow2",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30FSTabStage(p)
|
||||
addF30GRUB2Stage(p)
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "qcow2", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,9 @@ import "osbuild-composer/internal/pipeline"
|
|||
type tarOutput struct{}
|
||||
|
||||
func (t *tarOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewTarAssembler(
|
||||
&pipeline.TarAssemblerOptions{
|
||||
Filename: "image.tar",
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30SELinuxStage(p)
|
||||
addF30TarAssembler(p, t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import "osbuild-composer/internal/pipeline"
|
|||
type vhdOutput struct{}
|
||||
|
||||
func (t *vhdOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "qcow2",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30FSTabStage(p)
|
||||
addF30GRUB2Stage(p)
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "qcow2", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import "osbuild-composer/internal/pipeline"
|
|||
type vmdkOutput struct{}
|
||||
|
||||
func (t *vmdkOutput) translate(b *Blueprint) *pipeline.Pipeline {
|
||||
p := &pipeline.Pipeline{}
|
||||
p.SetAssembler(
|
||||
pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: "vmdk",
|
||||
Filename: t.getName(),
|
||||
}))
|
||||
p := getF30Pipeline()
|
||||
addF30FSTabStage(p)
|
||||
addF30GRUB2Stage(p)
|
||||
addF30SELinuxStage(p)
|
||||
addF30QemuAssembler(p, "vmdk", t.getName())
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ func TestCreate(t *testing.T) {
|
|||
store.PushCompose(id, &blueprint.Blueprint{}, "tar")
|
||||
|
||||
testRoute(t, api, "POST", "/job-queue/v1/jobs", `{}`, http.StatusCreated,
|
||||
`{"id":"ffffffff-ffff-ffff-ffff-ffffffffffff","pipeline":{"assembler":{"name":"org.osbuild.tar","options":{"filename":"image.tar"}}},"targets":[{"name":"org.osbuild.local","options":{"location":"/var/lib/osbuild-composer/outputs/ffffffff-ffff-ffff-ffff-ffffffffffff"}}]}`)
|
||||
`{"id":"ffffffff-ffff-ffff-ffff-ffffffffffff","pipeline":{"build":{"stages":[{"name":"org.osbuild.dnf","options":{"repos":[{"metalink":"https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever\u0026arch=$basearch","gpgkey":"F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9","checksum":"sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"}],"packages":["dnf","e2fsprogs","policycoreutils","qemu-img","systemd","grub2-pc","tar"],"releasever":"30","basearch":"x86_64"}}]},"stages":[{"name":"org.osbuild.dnf","options":{"repos":[{"metalink":"https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever\u0026arch=$basearch","gpgkey":"F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9","checksum":"sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"}],"packages":["@Core","chrony","kernel","selinux-policy-targeted","grub2-pc","spice-vdagent","qemu-guest-agent","xen-libs","langpacks-en"],"releasever":"30","basearch":"x86_64"}},{"name":"org.osbuild.fix-bls","options":{}},{"name":"org.osbuild.locale","options":{"language":"en_US"}},{"name":"org.osbuild.selinux","options":{"file_contexts":"etc/selinux/targeted/contexts/files/file_contexts"}}],"assembler":{"name":"org.osbuild.tar","options":{"filename":"image.tar"}}},"targets":[{"name":"org.osbuild.local","options":{"location":"/var/lib/osbuild-composer/outputs/ffffffff-ffff-ffff-ffff-ffffffffffff"}}]}`)
|
||||
}
|
||||
|
||||
func testUpdateTransition(t *testing.T, from, to string, expectedStatus int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue