pipeline: rename package to osbuild
Rename the package from `pipeline` to `osbuild` to reflect that it will no longer be specific to pipelines, but rather covers all osbuild datatypes. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
3ff88c336f
commit
d133454d91
30 changed files with 198 additions and 191 deletions
|
|
@ -3,11 +3,12 @@
|
|||
package compose
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
"time"
|
||||
)
|
||||
|
||||
type StateTransitionError struct {
|
||||
|
|
@ -31,7 +32,7 @@ type ImageBuild struct {
|
|||
Distro common.Distribution `json:"distro"`
|
||||
QueueStatus common.ImageBuildState `json:"queue_status"`
|
||||
ImageType common.ImageType `json:"image_type"`
|
||||
Pipeline *pipeline.Pipeline `json:"pipeline"`
|
||||
Pipeline *osbuild.Pipeline `json:"pipeline"`
|
||||
Targets []*target.Target `json:"targets"`
|
||||
JobCreated time.Time `json:"job_created"`
|
||||
JobStarted time.Time `json:"job_started"`
|
||||
|
|
@ -47,7 +48,7 @@ func (ib *ImageBuild) DeepCopy() ImageBuild {
|
|||
imageCopy := *ib.Image
|
||||
newImagePtr = &imageCopy
|
||||
}
|
||||
var newPipelinePtr *pipeline.Pipeline = nil
|
||||
var newPipelinePtr *osbuild.Pipeline = nil
|
||||
if ib.Pipeline != nil {
|
||||
pipelineCopy := *ib.Pipeline
|
||||
newPipelinePtr = &pipelineCopy
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@ package distro
|
|||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/fedora30"
|
||||
|
|
@ -42,7 +43,7 @@ type Distro interface {
|
|||
// Returns an osbuild pipeline that generates an image in the given
|
||||
// output format with all packages and customizations specified in the
|
||||
// given blueprint.
|
||||
Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*pipeline.Pipeline, error)
|
||||
Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*osbuild.Pipeline, error)
|
||||
|
||||
// Returns a osbuild runner that can be used on this distro.
|
||||
Runner() string
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
)
|
||||
|
||||
func TestDistro_Pipeline(t *testing.T) {
|
||||
|
|
@ -26,8 +26,8 @@ func TestDistro_Pipeline(t *testing.T) {
|
|||
Blueprint *blueprint.Blueprint `json:"blueprint"`
|
||||
}
|
||||
var tt struct {
|
||||
Compose *compose `json:"compose"`
|
||||
Pipeline *pipeline.Pipeline `json:"pipeline,omitempty"`
|
||||
Compose *compose `json:"compose"`
|
||||
Pipeline *osbuild.Pipeline `json:"pipeline,omitempty"`
|
||||
}
|
||||
file, err := ioutil.ReadFile(pipelinePath + fileInfo.Name())
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@ package fedora30
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"log"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/crypt"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ type output struct {
|
|||
KernelOptions string
|
||||
Bootable bool
|
||||
DefaultSize uint64
|
||||
Assembler func(uefi bool, size uint64) *pipeline.Assembler
|
||||
Assembler func(uefi bool, size uint64) *osbuild.Assembler
|
||||
}
|
||||
|
||||
const Distro = common.Fedora30
|
||||
|
|
@ -115,7 +116,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro no_timer_check console=ttyS0,115200n8 console=tty1 biosdevname=0 net.ifnames=0 console=ttyS0,115200",
|
||||
Bootable: true,
|
||||
DefaultSize: 6 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("raw.xz", "image.raw.xz", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -137,7 +138,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
Bootable: false,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler { return r.rawFSAssembler("filesystem.img", size) },
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler { return r.rawFSAssembler("filesystem.img", size) },
|
||||
}
|
||||
|
||||
r.outputs["partitioned-disk"] = output{
|
||||
|
|
@ -157,7 +158,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
Bootable: true,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("raw", "disk.img", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -184,7 +185,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
Bootable: true,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("qcow2", "disk.qcow2", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -210,7 +211,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
Bootable: true,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("qcow2", "disk.qcow2", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -232,7 +233,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
Bootable: false,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler { return r.tarAssembler("root.tar.xz", "xz") },
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler { return r.tarAssembler("root.tar.xz", "xz") },
|
||||
}
|
||||
|
||||
r.outputs["vhd"] = output{
|
||||
|
|
@ -267,7 +268,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0",
|
||||
Bootable: true,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("vpc", "disk.vhd", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -290,7 +291,7 @@ func New(confPaths []string) *Fedora30 {
|
|||
KernelOptions: "ro biosdevname=0 net.ifnames=0",
|
||||
Bootable: true,
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("vmdk", "disk.vmdk", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -342,7 +343,7 @@ func (r *Fedora30) GetSizeForOutputType(outputFormat string, size uint64) uint64
|
|||
return size
|
||||
}
|
||||
|
||||
func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*pipeline.Pipeline, error) {
|
||||
func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid output format: " + outputFormat)
|
||||
|
|
@ -353,42 +354,42 @@ func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.Repo
|
|||
return nil, errors.New("invalid architecture: " + outputArchitecture)
|
||||
}
|
||||
|
||||
p := &pipeline.Pipeline{}
|
||||
p := &osbuild.Pipeline{}
|
||||
p.SetBuild(r.buildPipeline(arch, checksums), "org.osbuild.fedora30")
|
||||
|
||||
packages := append(output.Packages, b.GetPackages()...)
|
||||
if output.Bootable {
|
||||
packages = append(packages, arch.BootloaderPackages...)
|
||||
}
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(pipeline.NewFixBLSStage())
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(osbuild.NewFixBLSStage())
|
||||
|
||||
// TODO support setting all languages and install corresponding langpack-* package
|
||||
language, keyboard := b.GetPrimaryLocale()
|
||||
|
||||
if language != nil {
|
||||
p.AddStage(pipeline.NewLocaleStage(&pipeline.LocaleStageOptions{*language}))
|
||||
p.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{*language}))
|
||||
} else {
|
||||
p.AddStage(pipeline.NewLocaleStage(&pipeline.LocaleStageOptions{"en_US"}))
|
||||
p.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{"en_US"}))
|
||||
}
|
||||
|
||||
if keyboard != nil {
|
||||
p.AddStage(pipeline.NewKeymapStage(&pipeline.KeymapStageOptions{*keyboard}))
|
||||
p.AddStage(osbuild.NewKeymapStage(&osbuild.KeymapStageOptions{*keyboard}))
|
||||
}
|
||||
|
||||
if hostname := b.GetHostname(); hostname != nil {
|
||||
p.AddStage(pipeline.NewHostnameStage(&pipeline.HostnameStageOptions{*hostname}))
|
||||
p.AddStage(osbuild.NewHostnameStage(&osbuild.HostnameStageOptions{*hostname}))
|
||||
}
|
||||
|
||||
timezone, ntpServers := b.GetTimezoneSettings()
|
||||
|
||||
// TODO install chrony when this is set?
|
||||
if timezone != nil {
|
||||
p.AddStage(pipeline.NewTimezoneStage(&pipeline.TimezoneStageOptions{*timezone}))
|
||||
p.AddStage(osbuild.NewTimezoneStage(&osbuild.TimezoneStageOptions{*timezone}))
|
||||
}
|
||||
|
||||
if len(ntpServers) > 0 {
|
||||
p.AddStage(pipeline.NewChronyStage(&pipeline.ChronyStageOptions{ntpServers}))
|
||||
p.AddStage(osbuild.NewChronyStage(&osbuild.ChronyStageOptions{ntpServers}))
|
||||
}
|
||||
|
||||
if users := b.GetUsers(); len(users) > 0 {
|
||||
|
|
@ -396,27 +397,27 @@ func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.Repo
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.AddStage(pipeline.NewUsersStage(options))
|
||||
p.AddStage(osbuild.NewUsersStage(options))
|
||||
}
|
||||
|
||||
if groups := b.GetGroups(); len(groups) > 0 {
|
||||
p.AddStage(pipeline.NewGroupsStage(r.groupStageOptions(groups)))
|
||||
p.AddStage(osbuild.NewGroupsStage(r.groupStageOptions(groups)))
|
||||
}
|
||||
|
||||
if output.Bootable {
|
||||
p.AddStage(pipeline.NewFSTabStage(r.fsTabStageOptions(arch.UEFI)))
|
||||
p.AddStage(osbuild.NewFSTabStage(r.fsTabStageOptions(arch.UEFI)))
|
||||
}
|
||||
p.AddStage(pipeline.NewGRUB2Stage(r.grub2StageOptions(output.KernelOptions, b.GetKernel(), arch.UEFI)))
|
||||
p.AddStage(osbuild.NewGRUB2Stage(r.grub2StageOptions(output.KernelOptions, b.GetKernel(), arch.UEFI)))
|
||||
|
||||
if services := b.GetServices(); services != nil || output.EnabledServices != nil {
|
||||
p.AddStage(pipeline.NewSystemdStage(r.systemdStageOptions(output.EnabledServices, output.DisabledServices, services)))
|
||||
p.AddStage(osbuild.NewSystemdStage(r.systemdStageOptions(output.EnabledServices, output.DisabledServices, services)))
|
||||
}
|
||||
|
||||
if firewall := b.GetFirewall(); firewall != nil {
|
||||
p.AddStage(pipeline.NewFirewallStage(r.firewallStageOptions(firewall)))
|
||||
p.AddStage(osbuild.NewFirewallStage(r.firewallStageOptions(firewall)))
|
||||
}
|
||||
|
||||
p.AddStage(pipeline.NewSELinuxStage(r.selinuxStageOptions()))
|
||||
p.AddStage(osbuild.NewSELinuxStage(r.selinuxStageOptions()))
|
||||
|
||||
p.Assembler = output.Assembler(arch.UEFI, size)
|
||||
|
||||
|
|
@ -427,7 +428,7 @@ func (r *Fedora30) Runner() string {
|
|||
return "org.osbuild.fedora30"
|
||||
}
|
||||
|
||||
func (r *Fedora30) buildPipeline(arch arch, checksums map[string]string) *pipeline.Pipeline {
|
||||
func (r *Fedora30) buildPipeline(arch arch, checksums map[string]string) *osbuild.Pipeline {
|
||||
packages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
|
|
@ -438,20 +439,20 @@ func (r *Fedora30) buildPipeline(arch arch, checksums map[string]string) *pipeli
|
|||
"tar",
|
||||
}
|
||||
packages = append(packages, arch.BuildPackages...)
|
||||
p := &pipeline.Pipeline{}
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(arch, nil, checksums, packages, nil)))
|
||||
p := &osbuild.Pipeline{}
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, nil, checksums, packages, nil)))
|
||||
return p
|
||||
}
|
||||
|
||||
func (r *Fedora30) dnfStageOptions(arch arch, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, packages, excludedPackages []string) *pipeline.DNFStageOptions {
|
||||
options := &pipeline.DNFStageOptions{
|
||||
func (r *Fedora30) dnfStageOptions(arch arch, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, packages, excludedPackages []string) *osbuild.DNFStageOptions {
|
||||
options := &osbuild.DNFStageOptions{
|
||||
ReleaseVersion: "30",
|
||||
BaseArchitecture: arch.Name,
|
||||
ModulePlatformId: "platform:f30",
|
||||
}
|
||||
|
||||
for _, repo := range append(arch.Repositories, additionalRepos...) {
|
||||
options.AddRepository(&pipeline.DNFRepository{
|
||||
options.AddRepository(&osbuild.DNFRepository{
|
||||
BaseURL: repo.BaseURL,
|
||||
MetaLink: repo.Metalink,
|
||||
MirrorList: repo.MirrorList,
|
||||
|
|
@ -473,9 +474,9 @@ func (r *Fedora30) dnfStageOptions(arch arch, additionalRepos []rpmmd.RepoConfig
|
|||
return options
|
||||
}
|
||||
|
||||
func (r *Fedora30) userStageOptions(users []blueprint.UserCustomization) (*pipeline.UsersStageOptions, error) {
|
||||
options := pipeline.UsersStageOptions{
|
||||
Users: make(map[string]pipeline.UsersStageOptionsUser),
|
||||
func (r *Fedora30) userStageOptions(users []blueprint.UserCustomization) (*osbuild.UsersStageOptions, error) {
|
||||
options := osbuild.UsersStageOptions{
|
||||
Users: make(map[string]osbuild.UsersStageOptionsUser),
|
||||
}
|
||||
|
||||
for _, c := range users {
|
||||
|
|
@ -488,7 +489,7 @@ func (r *Fedora30) userStageOptions(users []blueprint.UserCustomization) (*pipel
|
|||
c.Password = &cryptedPassword
|
||||
}
|
||||
|
||||
user := pipeline.UsersStageOptionsUser{
|
||||
user := osbuild.UsersStageOptionsUser{
|
||||
Groups: c.Groups,
|
||||
Description: c.Description,
|
||||
Home: c.Home,
|
||||
|
|
@ -513,13 +514,13 @@ func (r *Fedora30) userStageOptions(users []blueprint.UserCustomization) (*pipel
|
|||
return &options, nil
|
||||
}
|
||||
|
||||
func (r *Fedora30) groupStageOptions(groups []blueprint.GroupCustomization) *pipeline.GroupsStageOptions {
|
||||
options := pipeline.GroupsStageOptions{
|
||||
Groups: map[string]pipeline.GroupsStageOptionsGroup{},
|
||||
func (r *Fedora30) groupStageOptions(groups []blueprint.GroupCustomization) *osbuild.GroupsStageOptions {
|
||||
options := osbuild.GroupsStageOptions{
|
||||
Groups: map[string]osbuild.GroupsStageOptionsGroup{},
|
||||
}
|
||||
|
||||
for _, group := range groups {
|
||||
groupData := pipeline.GroupsStageOptionsGroup{
|
||||
groupData := osbuild.GroupsStageOptionsGroup{
|
||||
Name: group.Name,
|
||||
}
|
||||
if group.GID != nil {
|
||||
|
|
@ -533,8 +534,8 @@ func (r *Fedora30) groupStageOptions(groups []blueprint.GroupCustomization) *pip
|
|||
return &options
|
||||
}
|
||||
|
||||
func (r *Fedora30) firewallStageOptions(firewall *blueprint.FirewallCustomization) *pipeline.FirewallStageOptions {
|
||||
options := pipeline.FirewallStageOptions{
|
||||
func (r *Fedora30) firewallStageOptions(firewall *blueprint.FirewallCustomization) *osbuild.FirewallStageOptions {
|
||||
options := osbuild.FirewallStageOptions{
|
||||
Ports: firewall.Ports,
|
||||
}
|
||||
|
||||
|
|
@ -546,19 +547,19 @@ func (r *Fedora30) firewallStageOptions(firewall *blueprint.FirewallCustomizatio
|
|||
return &options
|
||||
}
|
||||
|
||||
func (r *Fedora30) systemdStageOptions(enabledServices, disabledServices []string, s *blueprint.ServicesCustomization) *pipeline.SystemdStageOptions {
|
||||
func (r *Fedora30) systemdStageOptions(enabledServices, disabledServices []string, s *blueprint.ServicesCustomization) *osbuild.SystemdStageOptions {
|
||||
if s != nil {
|
||||
enabledServices = append(enabledServices, s.Enabled...)
|
||||
disabledServices = append(disabledServices, s.Disabled...)
|
||||
}
|
||||
return &pipeline.SystemdStageOptions{
|
||||
return &osbuild.SystemdStageOptions{
|
||||
EnabledServices: enabledServices,
|
||||
DisabledServices: disabledServices,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Fedora30) fsTabStageOptions(uefi bool) *pipeline.FSTabStageOptions {
|
||||
options := pipeline.FSTabStageOptions{}
|
||||
func (r *Fedora30) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOptions {
|
||||
options := osbuild.FSTabStageOptions{}
|
||||
options.AddFilesystem("76a22bf4-f153-4541-b6c7-0332c0dfaeac", "ext4", "/", "defaults", 1, 1)
|
||||
if uefi {
|
||||
options.AddFilesystem("46BB-8120", "vfat", "/boot/efi", "umask=0077,shortname=winnt", 0, 2)
|
||||
|
|
@ -566,7 +567,7 @@ func (r *Fedora30) fsTabStageOptions(uefi bool) *pipeline.FSTabStageOptions {
|
|||
return &options
|
||||
}
|
||||
|
||||
func (r *Fedora30) grub2StageOptions(kernelOptions string, kernel *blueprint.KernelCustomization, uefi bool) *pipeline.GRUB2StageOptions {
|
||||
func (r *Fedora30) grub2StageOptions(kernelOptions string, kernel *blueprint.KernelCustomization, uefi bool) *osbuild.GRUB2StageOptions {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
|
|
@ -576,14 +577,14 @@ func (r *Fedora30) grub2StageOptions(kernelOptions string, kernel *blueprint.Ker
|
|||
kernelOptions += " " + kernel.Append
|
||||
}
|
||||
|
||||
var uefiOptions *pipeline.GRUB2UEFI
|
||||
var uefiOptions *osbuild.GRUB2UEFI
|
||||
if uefi {
|
||||
uefiOptions = &pipeline.GRUB2UEFI{
|
||||
uefiOptions = &osbuild.GRUB2UEFI{
|
||||
Vendor: "fedora",
|
||||
}
|
||||
}
|
||||
|
||||
return &pipeline.GRUB2StageOptions{
|
||||
return &osbuild.GRUB2StageOptions{
|
||||
RootFilesystemUUID: id,
|
||||
KernelOptions: kernelOptions,
|
||||
Legacy: !uefi,
|
||||
|
|
@ -591,28 +592,28 @@ func (r *Fedora30) grub2StageOptions(kernelOptions string, kernel *blueprint.Ker
|
|||
}
|
||||
}
|
||||
|
||||
func (r *Fedora30) selinuxStageOptions() *pipeline.SELinuxStageOptions {
|
||||
return &pipeline.SELinuxStageOptions{
|
||||
func (r *Fedora30) selinuxStageOptions() *osbuild.SELinuxStageOptions {
|
||||
return &osbuild.SELinuxStageOptions{
|
||||
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Fedora30) qemuAssembler(format string, filename string, uefi bool, size uint64) *pipeline.Assembler {
|
||||
var options pipeline.QEMUAssemblerOptions
|
||||
func (r *Fedora30) qemuAssembler(format string, filename string, uefi bool, size uint64) *osbuild.Assembler {
|
||||
var options osbuild.QEMUAssemblerOptions
|
||||
if uefi {
|
||||
fstype := uuid.MustParse("C12A7328-F81F-11D2-BA4B-00A0C93EC93B")
|
||||
options = pipeline.QEMUAssemblerOptions{
|
||||
options = osbuild.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
Size: size,
|
||||
PTUUID: "8DFDFF87-C96E-EA48-A3A6-9408F1F6B1EF",
|
||||
PTType: "gpt",
|
||||
Partitions: []pipeline.QEMUPartition{
|
||||
Partitions: []osbuild.QEMUPartition{
|
||||
{
|
||||
Start: 2048,
|
||||
Size: 972800,
|
||||
Type: &fstype,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Filesystem: osbuild.QEMUFilesystem{
|
||||
Type: "vfat",
|
||||
UUID: "46BB-8120",
|
||||
Label: "EFI System Partition",
|
||||
|
|
@ -621,7 +622,7 @@ func (r *Fedora30) qemuAssembler(format string, filename string, uefi bool, size
|
|||
},
|
||||
{
|
||||
Start: 976896,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Filesystem: osbuild.QEMUFilesystem{
|
||||
Type: "ext4",
|
||||
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
Mountpoint: "/",
|
||||
|
|
@ -630,17 +631,17 @@ func (r *Fedora30) qemuAssembler(format string, filename string, uefi bool, size
|
|||
},
|
||||
}
|
||||
} else {
|
||||
options = pipeline.QEMUAssemblerOptions{
|
||||
options = osbuild.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
Size: size,
|
||||
PTUUID: "0x14fc63d2",
|
||||
PTType: "mbr",
|
||||
Partitions: []pipeline.QEMUPartition{
|
||||
Partitions: []osbuild.QEMUPartition{
|
||||
{
|
||||
Start: 2048,
|
||||
Bootable: true,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Filesystem: osbuild.QEMUFilesystem{
|
||||
Type: "ext4",
|
||||
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
Mountpoint: "/",
|
||||
|
|
@ -649,24 +650,24 @@ func (r *Fedora30) qemuAssembler(format string, filename string, uefi bool, size
|
|||
},
|
||||
}
|
||||
}
|
||||
return pipeline.NewQEMUAssembler(&options)
|
||||
return osbuild.NewQEMUAssembler(&options)
|
||||
}
|
||||
|
||||
func (r *Fedora30) tarAssembler(filename, compression string) *pipeline.Assembler {
|
||||
return pipeline.NewTarAssembler(
|
||||
&pipeline.TarAssemblerOptions{
|
||||
func (r *Fedora30) tarAssembler(filename, compression string) *osbuild.Assembler {
|
||||
return osbuild.NewTarAssembler(
|
||||
&osbuild.TarAssemblerOptions{
|
||||
Filename: filename,
|
||||
Compression: compression,
|
||||
})
|
||||
}
|
||||
|
||||
func (r *Fedora30) rawFSAssembler(filename string, size uint64) *pipeline.Assembler {
|
||||
func (r *Fedora30) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
return pipeline.NewRawFSAssembler(
|
||||
&pipeline.RawFSAssemblerOptions{
|
||||
return osbuild.NewRawFSAssembler(
|
||||
&osbuild.RawFSAssemblerOptions{
|
||||
Filename: filename,
|
||||
RootFilesystemUUDI: id,
|
||||
Size: size,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ package fedoratest
|
|||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -48,9 +49,9 @@ func (r *FedoraTestDistro) GetSizeForOutputType(outputFormat string, size uint64
|
|||
return 0
|
||||
}
|
||||
|
||||
func (d *FedoraTestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArch, outputFormat string, size uint64) (*pipeline.Pipeline, error) {
|
||||
func (d *FedoraTestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArch, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
if outputFormat == "qcow2" && outputArch == "x86_64" {
|
||||
return &pipeline.Pipeline{}, nil
|
||||
return &osbuild.Pipeline{}, nil
|
||||
} else {
|
||||
return nil, errors.New("invalid output format or arch: " + outputFormat + " @ " + outputArch)
|
||||
}
|
||||
|
|
@ -59,4 +60,3 @@ func (d *FedoraTestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rp
|
|||
func (d *FedoraTestDistro) Runner() string {
|
||||
return "org.osbuild.test"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@ package rhel82
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"log"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/crypt"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ type output struct {
|
|||
DefaultTarget string
|
||||
KernelOptions string
|
||||
DefaultSize uint64
|
||||
Assembler func(uefi bool, size uint64) *pipeline.Assembler
|
||||
Assembler func(uefi bool, size uint64) *osbuild.Assembler
|
||||
}
|
||||
|
||||
const Distro = common.RHEL82
|
||||
|
|
@ -164,7 +165,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: true,
|
||||
KernelOptions: "ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
DefaultSize: 6 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("raw.xz", "image.raw.xz", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -191,7 +192,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: false,
|
||||
KernelOptions: "ro net.ifnames=0",
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler { return r.rawFSAssembler("filesystem.img", size) },
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler { return r.rawFSAssembler("filesystem.img", size) },
|
||||
}
|
||||
|
||||
r.outputs["partitioned-disk"] = output{
|
||||
|
|
@ -216,7 +217,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: true,
|
||||
KernelOptions: "ro net.ifnames=0",
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("raw", "disk.img", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -300,7 +301,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: true,
|
||||
KernelOptions: "console=ttyS0 console=ttyS0,115200n8 no_timer_check crashkernel=auto net.ifnames=0",
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("qcow2", "disk.qcow2", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -330,7 +331,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: true,
|
||||
KernelOptions: "ro net.ifnames=0",
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("qcow2", "disk.qcow2", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -356,7 +357,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
},
|
||||
Bootable: false,
|
||||
KernelOptions: "ro net.ifnames=0",
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler { return r.tarAssembler("root.tar.xz", "xz") },
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler { return r.tarAssembler("root.tar.xz", "xz") },
|
||||
}
|
||||
|
||||
r.outputs["vhd"] = output{
|
||||
|
|
@ -397,7 +398,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: true,
|
||||
KernelOptions: "ro biosdevname=0 rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0",
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("vpc", "disk.vhd", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -425,7 +426,7 @@ func New(confPaths []string) *RHEL82 {
|
|||
Bootable: true,
|
||||
KernelOptions: "ro net.ifnames=0",
|
||||
DefaultSize: 2 * GigaByte,
|
||||
Assembler: func(uefi bool, size uint64) *pipeline.Assembler {
|
||||
Assembler: func(uefi bool, size uint64) *osbuild.Assembler {
|
||||
return r.qemuAssembler("vmdk", "disk.vmdk", uefi, size)
|
||||
},
|
||||
}
|
||||
|
|
@ -477,7 +478,7 @@ func (r *RHEL82) GetSizeForOutputType(outputFormat string, size uint64) uint64 {
|
|||
return size
|
||||
}
|
||||
|
||||
func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*pipeline.Pipeline, error) {
|
||||
func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string, size uint64) (*osbuild.Pipeline, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid output format: " + outputFormat)
|
||||
|
|
@ -488,52 +489,52 @@ func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoCo
|
|||
return nil, errors.New("invalid architecture: " + outputArchitecture)
|
||||
}
|
||||
|
||||
p := &pipeline.Pipeline{}
|
||||
p := &osbuild.Pipeline{}
|
||||
p.SetBuild(r.buildPipeline(arch, checksums), "org.osbuild.rhel82")
|
||||
|
||||
packages := append(output.Packages, b.GetPackages()...)
|
||||
if output.Bootable {
|
||||
packages = append(packages, arch.BootloaderPackages...)
|
||||
}
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(pipeline.NewFixBLSStage())
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(osbuild.NewFixBLSStage())
|
||||
|
||||
if output.Bootable {
|
||||
p.AddStage(pipeline.NewFSTabStage(r.fsTabStageOptions(arch.UEFI)))
|
||||
p.AddStage(osbuild.NewFSTabStage(r.fsTabStageOptions(arch.UEFI)))
|
||||
}
|
||||
|
||||
kernelOptions := output.KernelOptions
|
||||
if kernel := b.GetKernel(); kernel != nil {
|
||||
kernelOptions += " " + kernel.Append
|
||||
}
|
||||
p.AddStage(pipeline.NewGRUB2Stage(r.grub2StageOptions(kernelOptions, arch.UEFI)))
|
||||
p.AddStage(osbuild.NewGRUB2Stage(r.grub2StageOptions(kernelOptions, arch.UEFI)))
|
||||
|
||||
// TODO support setting all languages and install corresponding langpack-* package
|
||||
language, keyboard := b.GetPrimaryLocale()
|
||||
|
||||
if language != nil {
|
||||
p.AddStage(pipeline.NewLocaleStage(&pipeline.LocaleStageOptions{*language}))
|
||||
p.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{*language}))
|
||||
} else {
|
||||
p.AddStage(pipeline.NewLocaleStage(&pipeline.LocaleStageOptions{"en_US"}))
|
||||
p.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{"en_US"}))
|
||||
}
|
||||
|
||||
if keyboard != nil {
|
||||
p.AddStage(pipeline.NewKeymapStage(&pipeline.KeymapStageOptions{*keyboard}))
|
||||
p.AddStage(osbuild.NewKeymapStage(&osbuild.KeymapStageOptions{*keyboard}))
|
||||
}
|
||||
|
||||
if hostname := b.GetHostname(); hostname != nil {
|
||||
p.AddStage(pipeline.NewHostnameStage(&pipeline.HostnameStageOptions{*hostname}))
|
||||
p.AddStage(osbuild.NewHostnameStage(&osbuild.HostnameStageOptions{*hostname}))
|
||||
}
|
||||
|
||||
timezone, ntpServers := b.GetTimezoneSettings()
|
||||
|
||||
// TODO install chrony when this is set?
|
||||
if timezone != nil {
|
||||
p.AddStage(pipeline.NewTimezoneStage(&pipeline.TimezoneStageOptions{*timezone}))
|
||||
p.AddStage(osbuild.NewTimezoneStage(&osbuild.TimezoneStageOptions{*timezone}))
|
||||
}
|
||||
|
||||
if len(ntpServers) > 0 {
|
||||
p.AddStage(pipeline.NewChronyStage(&pipeline.ChronyStageOptions{ntpServers}))
|
||||
p.AddStage(osbuild.NewChronyStage(&osbuild.ChronyStageOptions{ntpServers}))
|
||||
}
|
||||
|
||||
if users := b.GetUsers(); len(users) > 0 {
|
||||
|
|
@ -541,22 +542,22 @@ func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoCo
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.AddStage(pipeline.NewUsersStage(options))
|
||||
p.AddStage(osbuild.NewUsersStage(options))
|
||||
}
|
||||
|
||||
if groups := b.GetGroups(); len(groups) > 0 {
|
||||
p.AddStage(pipeline.NewGroupsStage(r.groupStageOptions(groups)))
|
||||
p.AddStage(osbuild.NewGroupsStage(r.groupStageOptions(groups)))
|
||||
}
|
||||
|
||||
if services := b.GetServices(); services != nil || output.EnabledServices != nil {
|
||||
p.AddStage(pipeline.NewSystemdStage(r.systemdStageOptions(output.EnabledServices, output.DisabledServices, services, output.DefaultTarget)))
|
||||
p.AddStage(osbuild.NewSystemdStage(r.systemdStageOptions(output.EnabledServices, output.DisabledServices, services, output.DefaultTarget)))
|
||||
}
|
||||
|
||||
if firewall := b.GetFirewall(); firewall != nil {
|
||||
p.AddStage(pipeline.NewFirewallStage(r.firewallStageOptions(firewall)))
|
||||
p.AddStage(osbuild.NewFirewallStage(r.firewallStageOptions(firewall)))
|
||||
}
|
||||
|
||||
p.AddStage(pipeline.NewSELinuxStage(r.selinuxStageOptions()))
|
||||
p.AddStage(osbuild.NewSELinuxStage(r.selinuxStageOptions()))
|
||||
|
||||
p.Assembler = output.Assembler(arch.UEFI, size)
|
||||
|
||||
|
|
@ -567,7 +568,7 @@ func (r *RHEL82) Runner() string {
|
|||
return "org.osbuild.rhel82"
|
||||
}
|
||||
|
||||
func (r *RHEL82) buildPipeline(arch arch, checksums map[string]string) *pipeline.Pipeline {
|
||||
func (r *RHEL82) buildPipeline(arch arch, checksums map[string]string) *osbuild.Pipeline {
|
||||
packages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
|
|
@ -582,19 +583,19 @@ func (r *RHEL82) buildPipeline(arch arch, checksums map[string]string) *pipeline
|
|||
"xfsprogs",
|
||||
}
|
||||
packages = append(packages, arch.BuildPackages...)
|
||||
p := &pipeline.Pipeline{}
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(arch, nil, checksums, packages, nil)))
|
||||
p := &osbuild.Pipeline{}
|
||||
p.AddStage(osbuild.NewDNFStage(r.dnfStageOptions(arch, nil, checksums, packages, nil)))
|
||||
return p
|
||||
}
|
||||
|
||||
func (r *RHEL82) dnfStageOptions(arch arch, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, packages, excludedPackages []string) *pipeline.DNFStageOptions {
|
||||
options := &pipeline.DNFStageOptions{
|
||||
func (r *RHEL82) dnfStageOptions(arch arch, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, packages, excludedPackages []string) *osbuild.DNFStageOptions {
|
||||
options := &osbuild.DNFStageOptions{
|
||||
ReleaseVersion: "8",
|
||||
BaseArchitecture: arch.Name,
|
||||
ModulePlatformId: "platform:el8",
|
||||
}
|
||||
for _, repo := range append(arch.Repositories, additionalRepos...) {
|
||||
options.AddRepository(&pipeline.DNFRepository{
|
||||
options.AddRepository(&osbuild.DNFRepository{
|
||||
BaseURL: repo.BaseURL,
|
||||
MetaLink: repo.Metalink,
|
||||
MirrorList: repo.MirrorList,
|
||||
|
|
@ -615,9 +616,9 @@ func (r *RHEL82) dnfStageOptions(arch arch, additionalRepos []rpmmd.RepoConfig,
|
|||
return options
|
||||
}
|
||||
|
||||
func (r *RHEL82) userStageOptions(users []blueprint.UserCustomization) (*pipeline.UsersStageOptions, error) {
|
||||
options := pipeline.UsersStageOptions{
|
||||
Users: make(map[string]pipeline.UsersStageOptionsUser),
|
||||
func (r *RHEL82) userStageOptions(users []blueprint.UserCustomization) (*osbuild.UsersStageOptions, error) {
|
||||
options := osbuild.UsersStageOptions{
|
||||
Users: make(map[string]osbuild.UsersStageOptionsUser),
|
||||
}
|
||||
|
||||
for _, c := range users {
|
||||
|
|
@ -630,7 +631,7 @@ func (r *RHEL82) userStageOptions(users []blueprint.UserCustomization) (*pipelin
|
|||
c.Password = &cryptedPassword
|
||||
}
|
||||
|
||||
user := pipeline.UsersStageOptionsUser{
|
||||
user := osbuild.UsersStageOptionsUser{
|
||||
Groups: c.Groups,
|
||||
Description: c.Description,
|
||||
Home: c.Home,
|
||||
|
|
@ -655,13 +656,13 @@ func (r *RHEL82) userStageOptions(users []blueprint.UserCustomization) (*pipelin
|
|||
return &options, nil
|
||||
}
|
||||
|
||||
func (r *RHEL82) groupStageOptions(groups []blueprint.GroupCustomization) *pipeline.GroupsStageOptions {
|
||||
options := pipeline.GroupsStageOptions{
|
||||
Groups: map[string]pipeline.GroupsStageOptionsGroup{},
|
||||
func (r *RHEL82) groupStageOptions(groups []blueprint.GroupCustomization) *osbuild.GroupsStageOptions {
|
||||
options := osbuild.GroupsStageOptions{
|
||||
Groups: map[string]osbuild.GroupsStageOptionsGroup{},
|
||||
}
|
||||
|
||||
for _, group := range groups {
|
||||
groupData := pipeline.GroupsStageOptionsGroup{
|
||||
groupData := osbuild.GroupsStageOptionsGroup{
|
||||
Name: group.Name,
|
||||
}
|
||||
if group.GID != nil {
|
||||
|
|
@ -675,8 +676,8 @@ func (r *RHEL82) groupStageOptions(groups []blueprint.GroupCustomization) *pipel
|
|||
return &options
|
||||
}
|
||||
|
||||
func (r *RHEL82) firewallStageOptions(firewall *blueprint.FirewallCustomization) *pipeline.FirewallStageOptions {
|
||||
options := pipeline.FirewallStageOptions{
|
||||
func (r *RHEL82) firewallStageOptions(firewall *blueprint.FirewallCustomization) *osbuild.FirewallStageOptions {
|
||||
options := osbuild.FirewallStageOptions{
|
||||
Ports: firewall.Ports,
|
||||
}
|
||||
|
||||
|
|
@ -688,20 +689,20 @@ func (r *RHEL82) firewallStageOptions(firewall *blueprint.FirewallCustomization)
|
|||
return &options
|
||||
}
|
||||
|
||||
func (r *RHEL82) systemdStageOptions(enabledServices, disabledServices []string, s *blueprint.ServicesCustomization, target string) *pipeline.SystemdStageOptions {
|
||||
func (r *RHEL82) systemdStageOptions(enabledServices, disabledServices []string, s *blueprint.ServicesCustomization, target string) *osbuild.SystemdStageOptions {
|
||||
if s != nil {
|
||||
enabledServices = append(enabledServices, s.Enabled...)
|
||||
disabledServices = append(disabledServices, s.Disabled...)
|
||||
}
|
||||
return &pipeline.SystemdStageOptions{
|
||||
return &osbuild.SystemdStageOptions{
|
||||
EnabledServices: enabledServices,
|
||||
DisabledServices: disabledServices,
|
||||
DefaultTarget: target,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RHEL82) fsTabStageOptions(uefi bool) *pipeline.FSTabStageOptions {
|
||||
options := pipeline.FSTabStageOptions{}
|
||||
func (r *RHEL82) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOptions {
|
||||
options := osbuild.FSTabStageOptions{}
|
||||
options.AddFilesystem("0bd700f8-090f-4556-b797-b340297ea1bd", "xfs", "/", "defaults", 0, 0)
|
||||
if uefi {
|
||||
options.AddFilesystem("46BB-8120", "vfat", "/boot/efi", "umask=0077,shortname=winnt", 0, 2)
|
||||
|
|
@ -709,20 +710,20 @@ func (r *RHEL82) fsTabStageOptions(uefi bool) *pipeline.FSTabStageOptions {
|
|||
return &options
|
||||
}
|
||||
|
||||
func (r *RHEL82) grub2StageOptions(kernelOptions string, uefi bool) *pipeline.GRUB2StageOptions {
|
||||
func (r *RHEL82) grub2StageOptions(kernelOptions string, uefi bool) *osbuild.GRUB2StageOptions {
|
||||
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
|
||||
var uefiOptions *pipeline.GRUB2UEFI
|
||||
var uefiOptions *osbuild.GRUB2UEFI
|
||||
if uefi {
|
||||
uefiOptions = &pipeline.GRUB2UEFI{
|
||||
uefiOptions = &osbuild.GRUB2UEFI{
|
||||
Vendor: "redhat",
|
||||
}
|
||||
}
|
||||
|
||||
return &pipeline.GRUB2StageOptions{
|
||||
return &osbuild.GRUB2StageOptions{
|
||||
RootFilesystemUUID: id,
|
||||
KernelOptions: kernelOptions,
|
||||
Legacy: !uefi,
|
||||
|
|
@ -730,28 +731,28 @@ func (r *RHEL82) grub2StageOptions(kernelOptions string, uefi bool) *pipeline.GR
|
|||
}
|
||||
}
|
||||
|
||||
func (r *RHEL82) selinuxStageOptions() *pipeline.SELinuxStageOptions {
|
||||
return &pipeline.SELinuxStageOptions{
|
||||
func (r *RHEL82) selinuxStageOptions() *osbuild.SELinuxStageOptions {
|
||||
return &osbuild.SELinuxStageOptions{
|
||||
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RHEL82) qemuAssembler(format string, filename string, uefi bool, size uint64) *pipeline.Assembler {
|
||||
var options pipeline.QEMUAssemblerOptions
|
||||
func (r *RHEL82) qemuAssembler(format string, filename string, uefi bool, size uint64) *osbuild.Assembler {
|
||||
var options osbuild.QEMUAssemblerOptions
|
||||
if uefi {
|
||||
fstype := uuid.MustParse("C12A7328-F81F-11D2-BA4B-00A0C93EC93B")
|
||||
options = pipeline.QEMUAssemblerOptions{
|
||||
options = osbuild.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
Size: size,
|
||||
PTUUID: "8DFDFF87-C96E-EA48-A3A6-9408F1F6B1EF",
|
||||
PTType: "gpt",
|
||||
Partitions: []pipeline.QEMUPartition{
|
||||
Partitions: []osbuild.QEMUPartition{
|
||||
{
|
||||
Start: 2048,
|
||||
Size: 972800,
|
||||
Type: &fstype,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Filesystem: osbuild.QEMUFilesystem{
|
||||
Type: "vfat",
|
||||
UUID: "46BB-8120",
|
||||
Label: "EFI System Partition",
|
||||
|
|
@ -760,7 +761,7 @@ func (r *RHEL82) qemuAssembler(format string, filename string, uefi bool, size u
|
|||
},
|
||||
{
|
||||
Start: 976896,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Filesystem: osbuild.QEMUFilesystem{
|
||||
Type: "xfs",
|
||||
UUID: "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
Mountpoint: "/",
|
||||
|
|
@ -769,17 +770,17 @@ func (r *RHEL82) qemuAssembler(format string, filename string, uefi bool, size u
|
|||
},
|
||||
}
|
||||
} else {
|
||||
options = pipeline.QEMUAssemblerOptions{
|
||||
options = osbuild.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
Size: size,
|
||||
PTUUID: "0x14fc63d2",
|
||||
PTType: "mbr",
|
||||
Partitions: []pipeline.QEMUPartition{
|
||||
Partitions: []osbuild.QEMUPartition{
|
||||
{
|
||||
Start: 2048,
|
||||
Bootable: true,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Filesystem: osbuild.QEMUFilesystem{
|
||||
Type: "xfs",
|
||||
UUID: "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
Mountpoint: "/",
|
||||
|
|
@ -788,24 +789,24 @@ func (r *RHEL82) qemuAssembler(format string, filename string, uefi bool, size u
|
|||
},
|
||||
}
|
||||
}
|
||||
return pipeline.NewQEMUAssembler(&options)
|
||||
return osbuild.NewQEMUAssembler(&options)
|
||||
}
|
||||
|
||||
func (r *RHEL82) tarAssembler(filename, compression string) *pipeline.Assembler {
|
||||
return pipeline.NewTarAssembler(
|
||||
&pipeline.TarAssemblerOptions{
|
||||
func (r *RHEL82) tarAssembler(filename, compression string) *osbuild.Assembler {
|
||||
return osbuild.NewTarAssembler(
|
||||
&osbuild.TarAssemblerOptions{
|
||||
Filename: filename,
|
||||
Compression: compression,
|
||||
})
|
||||
}
|
||||
|
||||
func (r *RHEL82) rawFSAssembler(filename string, size uint64) *pipeline.Assembler {
|
||||
func (r *RHEL82) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
|
||||
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
return pipeline.NewRawFSAssembler(
|
||||
&pipeline.RawFSAssemblerOptions{
|
||||
return osbuild.NewRawFSAssembler(
|
||||
&osbuild.RawFSAssemblerOptions{
|
||||
Filename: filename,
|
||||
RootFilesystemUUDI: id,
|
||||
Size: size,
|
||||
|
|
|
|||
|
|
@ -7,22 +7,24 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/compose"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
"github.com/osbuild/osbuild-composer/internal/upload/awsupload"
|
||||
)
|
||||
|
||||
type Job struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ImageBuildID int `json:"image_build_id"`
|
||||
Distro string `json:"distro"`
|
||||
Pipeline *pipeline.Pipeline `json:"pipeline"`
|
||||
Targets []*target.Target `json:"targets"`
|
||||
OutputType string `json:"output_type"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
ImageBuildID int `json:"image_build_id"`
|
||||
Distro string `json:"distro"`
|
||||
Pipeline *osbuild.Pipeline `json:"pipeline"`
|
||||
Targets []*target.Target `json:"targets"`
|
||||
OutputType string `json:"output_type"`
|
||||
}
|
||||
|
||||
type JobStatus struct {
|
||||
|
|
@ -51,7 +53,7 @@ func (job *Job) Run(uploader LocalTargetUploader) (*common.ComposeResult, error)
|
|||
return nil, fmt.Errorf("unknown distro: %s", job.Distro)
|
||||
}
|
||||
|
||||
build := pipeline.Build{
|
||||
build := osbuild.Build{
|
||||
Runner: d.Runner(),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type ChronyStageOptions struct {
|
||||
Timeservers []string `json:"timeservers"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// The DNFStageOptions describe the operations of the DNF stage.
|
||||
//
|
||||
|
|
@ -13,7 +13,7 @@ type DNFStageOptions struct {
|
|||
ExcludedPackages []string `json:"exclude_packages,omitempty"`
|
||||
ReleaseVersion string `json:"releasever"`
|
||||
BaseArchitecture string `json:"basearch"`
|
||||
ModulePlatformId string `json:"module_platform_id,omitempty"`
|
||||
ModulePlatformId string `json:"module_platform_id,omitempty"`
|
||||
}
|
||||
|
||||
func (DNFStageOptions) isStageOptions() {}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type FirewallStageOptions struct {
|
||||
Ports []string `json:"ports,omitempty"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// A FixBLSStageOptions struct is empty, as the stage takes no options.
|
||||
//
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// The FSTabStageOptions describe the content of the /etc/fstab file.
|
||||
//
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type GroupsStageOptions struct {
|
||||
Groups map[string]GroupsStageOptionsGroup `json:"groups"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type HostnameStageOptions struct {
|
||||
Hostname string `json:"hostname"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type KeymapStageOptions struct {
|
||||
Keymap string `json:"keymap"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// The LocaleStageOptions describes the image's locale.
|
||||
//
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Package pipeline provides primitives for representing and (un)marshalling
|
||||
// OSBuild pipelines.
|
||||
package pipeline
|
||||
// Package osbuild provides primitives for representing and (un)marshalling
|
||||
// OSBuild types.
|
||||
package osbuild
|
||||
|
||||
// A Pipeline represents an OSBuild pipeline
|
||||
type Pipeline struct {
|
||||
|
|
@ -25,7 +25,7 @@ type Build struct {
|
|||
func (p *Pipeline) SetBuild(pipeline *Pipeline, runner string) {
|
||||
p.Build = &Build{
|
||||
Pipeline: pipeline,
|
||||
Runner: runner,
|
||||
Runner: runner,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// The ScriptStageOptions specifies a custom script to run in the image
|
||||
type ScriptStageOptions struct {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// The SELinuxStageOptions describe how to apply selinux labels.
|
||||
//
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type SystemdStageOptions struct {
|
||||
EnabledServices []string `json:"enabled_services,omitempty"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
// TarAssemblerOptions desrcibe how to assemble a tree into a tar ball.
|
||||
//
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type TimezoneStageOptions struct {
|
||||
Zone string `json:"zone"`
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pipeline
|
||||
package osbuild
|
||||
|
||||
type UsersStageOptions struct {
|
||||
Users map[string]UsersStageOptionsUser `json:"users"`
|
||||
|
|
@ -10,7 +10,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/osbuild/osbuild-composer/internal/compose"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
|
@ -22,10 +21,12 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/compose"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ type Job struct {
|
|||
ComposeID uuid.UUID
|
||||
ImageBuildID int
|
||||
Distro string
|
||||
Pipeline *pipeline.Pipeline
|
||||
Pipeline *osbuild.Pipeline
|
||||
Targets []*target.Target
|
||||
ImageType string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue