QCOW2 image generation and output test

This commit is contained in:
Martin Sehnoutka 2019-10-18 10:53:00 +02:00 committed by Tom Gundersen
parent 09ac84926e
commit 96d401b212
11 changed files with 74 additions and 18 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ __pycache__
/osbuild-composer
/osbuild-worker
/osbuild-pipeline

View file

@ -2,6 +2,7 @@
build:
go build -o osbuild-composer ./cmd/osbuild-composer/
go build -o osbuild-worker ./cmd/osbuild-worker/
go build -o osbuild-pipeline ./cmd/osbuild-pipeline/
.PHONY: install
install:

View file

@ -78,7 +78,7 @@ func addF30FSTabStage(p *pipeline.Pipeline) {
panic("invalid UUID")
}
options := &pipeline.FSTabStageOptions{}
options.AddFilesystem(id, "extf4", "/", "defaults", 1, 1)
options.AddFilesystem(id, "ext4", "/", "defaults", 1, 1)
p.AddStage(pipeline.NewFSTabStage(options))
}
@ -89,6 +89,17 @@ func addF30SELinuxStage(p *pipeline.Pipeline) {
}))
}
func addF30LocaleStage(p *pipeline.Pipeline) {
p.AddStage(pipeline.NewLocaleStage(
&pipeline.LocaleStageOptions{
Language: "en_US",
}))
}
func addF30FixBlsStage(p *pipeline.Pipeline) {
p.AddStage(pipeline.NewFixBLSStage())
}
func addF30QemuAssembler(p *pipeline.Pipeline, format string, filename string) {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {

View file

@ -68,7 +68,7 @@
"filesystems": [
{
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"vfs_type": "extf4",
"vfs_type": "ext4",
"path": "/",
"options": "defaults",
"freq": 1,

View file

@ -68,7 +68,7 @@
"filesystems": [
{
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"vfs_type": "extf4",
"vfs_type": "ext4",
"path": "/",
"options": "defaults",
"freq": 1,

View file

@ -68,7 +68,7 @@
"filesystems": [
{
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"vfs_type": "extf4",
"vfs_type": "ext4",
"path": "/",
"options": "defaults",
"freq": 1,

View file

@ -38,24 +38,26 @@
}
],
"packages": [
"@Core",
"kernel-core",
"@Fedora Cloud Server",
"chrony",
"kernel",
"polkit",
"systemd-udev",
"selinux-policy-targeted",
"grub2-pc",
"spice-vdagent",
"qemu-guest-agent",
"xen-libs",
"langpacks-en"
],
"exclude_packages": [
"dracut-config-rescue",
"etables",
"firewalld",
"gobject-introspection",
"plymouth"
],
"releasever": "30",
"basearch": "x86_64"
}
},
{
"name": "org.osbuild.fix-bls",
"options": {}
},
{
"name": "org.osbuild.locale",
"options": {
@ -68,7 +70,7 @@
"filesystems": [
{
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"vfs_type": "extf4",
"vfs_type": "ext4",
"path": "/",
"options": "defaults",
"freq": 1,
@ -90,6 +92,10 @@
"options": {
"file_contexts": "etc/selinux/targeted/contexts/files/file_contexts"
}
},
{
"name": "org.osbuild.fix-bls",
"options": {}
}
],
"assembler": {
@ -102,4 +108,4 @@
"size": 3221225472
}
}
}
}

View file

@ -68,7 +68,7 @@
"filesystems": [
{
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"vfs_type": "extf4",
"vfs_type": "ext4",
"path": "/",
"options": "defaults",
"freq": 1,

View file

@ -68,7 +68,7 @@
"filesystems": [
{
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"vfs_type": "extf4",
"vfs_type": "ext4",
"path": "/",
"options": "defaults",
"freq": 1,

View file

@ -5,11 +5,42 @@ import "github.com/osbuild/osbuild-composer/internal/pipeline"
type qcow2Output struct{}
func (t *qcow2Output) translate(b *Blueprint) *pipeline.Pipeline {
p := getF30Pipeline()
p := &pipeline.Pipeline{
BuildPipeline: getF30BuildPipeline(),
}
options := &pipeline.DNFStageOptions{
ReleaseVersion: "30",
BaseArchitecture: "x86_64",
}
options.AddRepository(getF30Repository())
packages := [...]string{"kernel-core",
"@Fedora Cloud Server",
"chrony",
"polkit",
"systemd-udev",
"selinux-policy-targeted",
"grub2-pc",
"langpacks-en"}
for _, pkg := range packages {
options.AddPackage(pkg)
}
excludedPackages := [...]string{"dracut-config-rescue",
"etables",
"firewalld",
"gobject-introspection",
"plymouth"}
for _, pkg := range excludedPackages {
options.ExcludePackage(pkg)
}
p.AddStage(pipeline.NewDNFStage(options))
addF30LocaleStage(p)
addF30FSTabStage(p)
addF30GRUB2Stage(p)
addF30SELinuxStage(p)
addF30FixBlsStage(p)
addF30QemuAssembler(p, "qcow2", t.getName())
return p
}

View file

@ -10,6 +10,7 @@ package pipeline
type DNFStageOptions struct {
Repositories []*DNFRepository `json:"repos"`
Packages []string `json:"packages"`
ExcludedPackages []string `json:"exclude_packages,omitempty"`
ReleaseVersion string `json:"releasever"`
BaseArchitecture string `json:"basearch"`
}
@ -50,6 +51,11 @@ func (options *DNFStageOptions) AddPackage(pkg string) {
options.Packages = append(options.Packages, pkg)
}
// ExcludePackage adds an excluded package to a DNFStageOptions object.
func (options *DNFStageOptions) ExcludePackage(pkg string) {
options.ExcludedPackages = append(options.ExcludedPackages, pkg)
}
// AddRepository adds a repository to a DNFStageOptions object.
func (options *DNFStageOptions) AddRepository(repo *DNFRepository) {
options.Repositories = append(options.Repositories, repo)