manifest: don't stutter

Replace `pipeline.OSPipeline` with `pipeline.OS`, etc.

Also rename `LiveImg` to `RawImage`.
This commit is contained in:
Tom Gundersen 2022-07-08 02:20:59 +01:00
parent 529bc803db
commit d00b98c134
16 changed files with 286 additions and 286 deletions

View file

@ -40,10 +40,10 @@ func (img *MyImage) InstantiateManifest(m *manifest.Manifest, repos []rpmmd.Repo
// Let's create a simple OCI container!
// configure a build pipeline
build := manifest.NewBuildPipeline(m, runner, repos)
build := manifest.NewBuild(m, runner, repos)
// create a non-bootable OS tree containing the `core` comps group
os := manifest.NewOSPipeline(m, build, &platform.X86{}, repos)
os := manifest.NewOS(m, build, &platform.X86{}, repos)
os.ExtraBasePackages = []string{
"@core",
}
@ -53,7 +53,7 @@ func (img *MyImage) InstantiateManifest(m *manifest.Manifest, repos []rpmmd.Repo
filename = img.Filename
}
// create an OCI container containing the OS tree created above
manifest.NewOCIContainerPipeline(m, build, &os.BasePipeline, "x86_64", filename)
manifest.NewOCIContainer(m, build, &os.Base, "x86_64", filename)
return nil
}

View file

@ -19,13 +19,13 @@ func qcow2Manifest(m *manifest.Manifest,
packageSets map[string]rpmmd.PackageSet,
rng *rand.Rand) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, rng)
if err != nil {
return err
}
imagePipeline := manifest.NewLiveImgPipeline(m, buildPipeline, treePipeline, "disk.img")
qcow2Pipeline := manifest.NewQCOW2Pipeline(m, buildPipeline, imagePipeline, t.filename)
imagePipeline := manifest.NewRawImage(m, buildPipeline, treePipeline, "disk.img")
qcow2Pipeline := manifest.NewQCOW2(m, buildPipeline, imagePipeline, t.filename)
qcow2Pipeline.Compat = "1.1"
return nil
@ -40,13 +40,13 @@ func vhdManifest(m *manifest.Manifest,
packageSets map[string]rpmmd.PackageSet,
rng *rand.Rand) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, rng)
if err != nil {
return err
}
imagePipeline := manifest.NewLiveImgPipeline(m, buildPipeline, treePipeline, "disk.img")
manifest.NewVPCPipeline(m, buildPipeline, imagePipeline, t.filename)
imagePipeline := manifest.NewRawImage(m, buildPipeline, treePipeline, "disk.img")
manifest.NewVPC(m, buildPipeline, imagePipeline, t.filename)
return nil
}
@ -60,13 +60,13 @@ func vmdkManifest(m *manifest.Manifest,
packageSets map[string]rpmmd.PackageSet,
rng *rand.Rand) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, rng)
if err != nil {
return err
}
imagePipeline := manifest.NewLiveImgPipeline(m, buildPipeline, treePipeline, "disk.img")
manifest.NewVMDKPipeline(m, buildPipeline, imagePipeline, t.filename)
imagePipeline := manifest.NewRawImage(m, buildPipeline, treePipeline, "disk.img")
manifest.NewVMDK(m, buildPipeline, imagePipeline, t.filename)
return nil
}
@ -80,13 +80,13 @@ func openstackManifest(m *manifest.Manifest,
packageSets map[string]rpmmd.PackageSet,
rng *rand.Rand) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, rng)
if err != nil {
return err
}
imagePipeline := manifest.NewLiveImgPipeline(m, buildPipeline, treePipeline, "disk.img")
manifest.NewQCOW2Pipeline(m, buildPipeline, imagePipeline, t.filename)
imagePipeline := manifest.NewRawImage(m, buildPipeline, treePipeline, "disk.img")
manifest.NewQCOW2(m, buildPipeline, imagePipeline, t.filename)
return nil
}
@ -101,12 +101,12 @@ func ec2CommonManifest(m *manifest.Manifest,
rng *rand.Rand,
diskfile string) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, rng)
if err != nil {
return nil
}
manifest.NewLiveImgPipeline(m, buildPipeline, treePipeline, diskfile)
manifest.NewRawImage(m, buildPipeline, treePipeline, diskfile)
return nil
}
@ -132,7 +132,7 @@ func iotInstallerManifest(m *manifest.Manifest,
packageSets map[string]rpmmd.PackageSet,
rng *rand.Rand) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
d := t.arch.distro
ksUsers := len(customizations.GetUsers())+len(customizations.GetGroups()) > 0
@ -150,10 +150,10 @@ func iotCorePipelines(m *manifest.Manifest,
customizations *blueprint.Customizations,
options distro.ImageOptions,
repos []rpmmd.RepoConfig,
packageSets map[string]rpmmd.PackageSet) (*manifest.BuildPipeline,
*manifest.OSTreeCommitPipeline,
packageSets map[string]rpmmd.PackageSet) (*manifest.Build,
*manifest.OSTreeCommit,
error) {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, nil)
if err != nil {
return nil, nil, err
@ -176,7 +176,7 @@ func iotCommitManifest(m *manifest.Manifest,
if err != nil {
return err
}
manifest.NewTarPipeline(m, buildPipeline, &commitPipeline.BasePipeline, "commit-archive", t.Filename())
manifest.NewTar(m, buildPipeline, &commitPipeline.Base, "commit-archive", t.Filename())
return nil
}
@ -197,7 +197,7 @@ func iotContainerManifest(m *manifest.Manifest,
nginxConfigPath := "/etc/nginx.conf"
httpPort := "8080"
containerTreePipeline := containerTreePipeline(m, buildPipeline, commitPipeline, repos, packageSets[containerPkgsKey], options, customizations, nginxConfigPath, httpPort)
containerPipeline(m, buildPipeline, &containerTreePipeline.BasePipeline, t, nginxConfigPath, httpPort)
containerPipeline(m, buildPipeline, &containerTreePipeline.Base, t, nginxConfigPath, httpPort)
return nil
}
@ -211,29 +211,29 @@ func containerManifest(m *manifest.Manifest,
packageSets map[string]rpmmd.PackageSet,
rng *rand.Rand) error {
buildPipeline := manifest.NewBuildPipeline(m, t.arch.distro.runner, repos)
buildPipeline := manifest.NewBuild(m, t.arch.distro.runner, repos)
treePipeline, err := osPipeline(m, buildPipeline, workload, t, repos, packageSets[osPkgsKey], customizations, options, rng)
if err != nil {
return err
}
manifest.NewOCIContainerPipeline(m, buildPipeline, &treePipeline.BasePipeline, t.Arch().Name(), t.Filename())
manifest.NewOCIContainer(m, buildPipeline, &treePipeline.Base, t.Arch().Name(), t.Filename())
return nil
}
func osPipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
buildPipeline *manifest.Build,
workload workload.Workload,
t *imageType,
repos []rpmmd.RepoConfig,
osPackageSet rpmmd.PackageSet,
c *blueprint.Customizations,
options distro.ImageOptions,
rng *rand.Rand) (*manifest.OSPipeline, error) {
rng *rand.Rand) (*manifest.OS, error) {
imageConfig := t.getDefaultImageConfig()
pl := manifest.NewOSPipeline(m, buildPipeline, t.platform, repos)
pl := manifest.NewOS(m, buildPipeline, t.platform, repos)
pl.Environment = t.environment
pl.Workload = workload
@ -347,25 +347,25 @@ func osPipeline(m *manifest.Manifest,
}
func ostreeCommitPipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
treePipeline *manifest.OSPipeline,
buildPipeline *manifest.Build,
treePipeline *manifest.OS,
options distro.ImageOptions,
osVersion string) *manifest.OSTreeCommitPipeline {
p := manifest.NewOSTreeCommitPipeline(m, buildPipeline, treePipeline, options.OSTree.Ref)
osVersion string) *manifest.OSTreeCommit {
p := manifest.NewOSTreeCommit(m, buildPipeline, treePipeline, options.OSTree.Ref)
p.OSVersion = osVersion
return p
}
func containerTreePipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
commitPipeline *manifest.OSTreeCommitPipeline,
buildPipeline *manifest.Build,
commitPipeline *manifest.OSTreeCommit,
repos []rpmmd.RepoConfig,
containerPackageSet rpmmd.PackageSet,
options distro.ImageOptions,
c *blueprint.Customizations,
nginxConfigPath,
listenPort string) *manifest.OSTreeCommitServerTreePipeline {
p := manifest.NewOSTreeCommitServerTreePipeline(m, buildPipeline, repos, commitPipeline, nginxConfigPath, listenPort)
listenPort string) *manifest.OSTreeCommitServer {
p := manifest.NewOSTreeCommitServer(m, buildPipeline, repos, commitPipeline, nginxConfigPath, listenPort)
p.ExtraPackages = containerPackageSet.Include
p.ExtraRepos = containerPackageSet.Repositories
language, _ := c.GetPrimaryLocale()
@ -376,24 +376,24 @@ func containerTreePipeline(m *manifest.Manifest,
}
func containerPipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
treePipeline *manifest.BasePipeline,
buildPipeline *manifest.Build,
treePipeline *manifest.Base,
t *imageType,
nginxConfigPath,
listenPort string) *manifest.OCIContainerPipeline {
p := manifest.NewOCIContainerPipeline(m, buildPipeline, treePipeline, t.Arch().Name(), t.Filename())
listenPort string) *manifest.OCIContainer {
p := manifest.NewOCIContainer(m, buildPipeline, treePipeline, t.Arch().Name(), t.Filename())
p.Cmd = []string{"nginx", "-c", nginxConfigPath}
p.ExposedPorts = []string{listenPort}
return p
}
func anacondaTreePipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
buildPipeline *manifest.Build,
repos []rpmmd.RepoConfig,
installerPackageSet rpmmd.PackageSet,
arch, product, osVersion, variant string,
users bool) *manifest.AnacondaPipeline {
p := manifest.NewAnacondaPipeline(m, buildPipeline, repos, "kernel", arch, product, osVersion)
users bool) *manifest.Anaconda {
p := manifest.NewAnaconda(m, buildPipeline, repos, "kernel", arch, product, osVersion)
p.ExtraPackages = installerPackageSet.Include
p.ExtraRepos = installerPackageSet.Repositories
@ -404,14 +404,14 @@ func anacondaTreePipeline(m *manifest.Manifest,
}
func bootISOTreePipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
anacondaPipeline *manifest.AnacondaPipeline,
buildPipeline *manifest.Build,
anacondaPipeline *manifest.Anaconda,
options distro.ImageOptions,
vendor,
isoLabelTempl string,
users []blueprint.UserCustomization,
groups []blueprint.GroupCustomization) *manifest.ISOTreePipeline {
p := manifest.NewISOTreePipeline(m, buildPipeline, anacondaPipeline, options.OSTree.Parent, options.OSTree.URL, options.OSTree.Ref, isoLabelTempl)
groups []blueprint.GroupCustomization) *manifest.ISOTree {
p := manifest.NewISOTree(m, buildPipeline, anacondaPipeline, options.OSTree.Parent, options.OSTree.URL, options.OSTree.Ref, isoLabelTempl)
p.Release = "202010217.n.0"
p.OSName = "fedora"
p.UEFIVendor = vendor
@ -422,11 +422,11 @@ func bootISOTreePipeline(m *manifest.Manifest,
}
func bootISOPipeline(m *manifest.Manifest,
buildPipeline *manifest.BuildPipeline,
treePipeline *manifest.ISOTreePipeline,
buildPipeline *manifest.Build,
treePipeline *manifest.ISOTree,
filename string,
isolinux bool) *manifest.ISOPipeline {
p := manifest.NewISOPipeline(m, buildPipeline, treePipeline, filename)
isolinux bool) *manifest.ISO {
p := manifest.NewISO(m, buildPipeline, treePipeline, filename)
p.ISOLinux = isolinux
return p
}

View file

@ -7,9 +7,9 @@ import (
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
// An AnacondaPipeline represents the installer tree as found on an ISO.
type AnacondaPipeline struct {
BasePipeline
// An Anaconda represents the installer tree as found on an ISO.
type Anaconda struct {
Base
// Packages to install in addition to the ones required by the
// pipeline.
ExtraPackages []string
@ -38,26 +38,26 @@ type AnacondaPipeline struct {
version string
}
// NewAnacondaPipeline creates an anaconda pipeline object. repos and packages
// NewAnaconda creates an anaconda pipeline object. repos and packages
// indicate the content to build the installer from, which is distinct from the
// packages the installer will install on the target system. kernelName is the
// name of the kernel package the intsaller will use. arch is the supported
// architecture. Product and version refers to the product the installer is the
// installer for.
func NewAnacondaPipeline(m *Manifest,
buildPipeline *BuildPipeline,
func NewAnaconda(m *Manifest,
buildPipeline *Build,
repos []rpmmd.RepoConfig,
kernelName,
arch,
product,
version string) *AnacondaPipeline {
p := &AnacondaPipeline{
BasePipeline: NewBasePipeline(m, "anaconda-tree", buildPipeline),
repos: repos,
kernelName: kernelName,
arch: arch,
product: product,
version: version,
version string) *Anaconda {
p := &Anaconda{
Base: NewBase(m, "anaconda-tree", buildPipeline),
repos: repos,
kernelName: kernelName,
arch: arch,
product: product,
version: version,
}
buildPipeline.addDependent(p)
m.addPipeline(p)
@ -66,7 +66,7 @@ func NewAnacondaPipeline(m *Manifest,
// TODO: refactor - what is required to boot and what to build, and
// do they all belong in this pipeline?
func (p *AnacondaPipeline) anacondaBootPackageSet() []string {
func (p *Anaconda) anacondaBootPackageSet() []string {
packages := []string{
"grub2-tools",
"grub2-tools-extra",
@ -99,7 +99,7 @@ func (p *AnacondaPipeline) anacondaBootPackageSet() []string {
return packages
}
func (p *AnacondaPipeline) getBuildPackages() []string {
func (p *Anaconda) getBuildPackages() []string {
packages := p.anacondaBootPackageSet()
packages = append(packages,
"rpm",
@ -108,7 +108,7 @@ func (p *AnacondaPipeline) getBuildPackages() []string {
return packages
}
func (p *AnacondaPipeline) getPackageSetChain() []rpmmd.PackageSet {
func (p *Anaconda) getPackageSetChain() []rpmmd.PackageSet {
packages := p.anacondaBootPackageSet()
return []rpmmd.PackageSet{
{
@ -118,11 +118,11 @@ func (p *AnacondaPipeline) getPackageSetChain() []rpmmd.PackageSet {
}
}
func (p *AnacondaPipeline) getPackageSpecs() []rpmmd.PackageSpec {
func (p *Anaconda) getPackageSpecs() []rpmmd.PackageSpec {
return p.packageSpecs
}
func (p *AnacondaPipeline) serializeStart(packages []rpmmd.PackageSpec) {
func (p *Anaconda) serializeStart(packages []rpmmd.PackageSpec) {
if len(p.packageSpecs) > 0 {
panic("double call to serializeStart()")
}
@ -132,7 +132,7 @@ func (p *AnacondaPipeline) serializeStart(packages []rpmmd.PackageSpec) {
}
}
func (p *AnacondaPipeline) serializeEnd() {
func (p *Anaconda) serializeEnd() {
if len(p.packageSpecs) == 0 {
panic("serializeEnd() call when serialization not in progress")
}
@ -140,11 +140,11 @@ func (p *AnacondaPipeline) serializeEnd() {
p.packageSpecs = nil
}
func (p *AnacondaPipeline) serialize() osbuild2.Pipeline {
func (p *Anaconda) serialize() osbuild2.Pipeline {
if len(p.packageSpecs) == 0 {
panic("serialization not started")
}
pipeline := p.BasePipeline.serialize()
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild2.NewRPMStage(osbuild2.NewRPMStageOptions(p.repos), osbuild2.NewRpmStageSourceFilesInputs(p.packageSpecs)))
pipeline.AddStage(osbuild2.NewBuildstampStage(&osbuild2.BuildstampStageOptions{

View file

@ -6,15 +6,15 @@ import (
"github.com/osbuild/osbuild-composer/internal/runner"
)
// A BuildPipeline represents the build environment for other pipelines. As a
// A Build represents the build environment for other pipelines. As a
// general rule, tools required to build pipelines are used from the build
// environment, rather than from the pipeline itself. Without a specified
// build environment, the build host's root filesystem would be used, which
// is not predictable nor reproducible. For the purposes of building the
// build pipeline, we do use the build host's filesystem, this means we should
// make minimal assumptions about what's available there.
type BuildPipeline struct {
BasePipeline
type Build struct {
Base
runner runner.Runner
dependents []Pipeline
@ -22,24 +22,24 @@ type BuildPipeline struct {
packageSpecs []rpmmd.PackageSpec
}
// NewBuildPipeline creates a new build pipeline from the repositories in repos
// NewBuild creates a new build pipeline from the repositories in repos
// and the specified packages.
func NewBuildPipeline(m *Manifest, runner runner.Runner, repos []rpmmd.RepoConfig) *BuildPipeline {
pipeline := &BuildPipeline{
BasePipeline: NewBasePipeline(m, "build", nil),
runner: runner,
dependents: make([]Pipeline, 0),
repos: repos,
func NewBuild(m *Manifest, runner runner.Runner, repos []rpmmd.RepoConfig) *Build {
pipeline := &Build{
Base: NewBase(m, "build", nil),
runner: runner,
dependents: make([]Pipeline, 0),
repos: repos,
}
m.addPipeline(pipeline)
return pipeline
}
func (p *BuildPipeline) addDependent(dep Pipeline) {
func (p *Build) addDependent(dep Pipeline) {
p.dependents = append(p.dependents, dep)
}
func (p *BuildPipeline) getPackageSetChain() []rpmmd.PackageSet {
func (p *Build) getPackageSetChain() []rpmmd.PackageSet {
// TODO: make the /usr/bin/cp dependency conditional
// TODO: make the /usr/bin/xz dependency conditional
packages := []string{
@ -62,29 +62,29 @@ func (p *BuildPipeline) getPackageSetChain() []rpmmd.PackageSet {
}
}
func (p *BuildPipeline) getPackageSpecs() []rpmmd.PackageSpec {
func (p *Build) getPackageSpecs() []rpmmd.PackageSpec {
return p.packageSpecs
}
func (p *BuildPipeline) serializeStart(packages []rpmmd.PackageSpec) {
func (p *Build) serializeStart(packages []rpmmd.PackageSpec) {
if len(p.packageSpecs) > 0 {
panic("double call to serializeStart()")
}
p.packageSpecs = packages
}
func (p *BuildPipeline) serializeEnd() {
func (p *Build) serializeEnd() {
if len(p.packageSpecs) == 0 {
panic("serializeEnd() call when serialization not in progress")
}
p.packageSpecs = nil
}
func (p *BuildPipeline) serialize() osbuild2.Pipeline {
func (p *Build) serialize() osbuild2.Pipeline {
if len(p.packageSpecs) == 0 {
panic("serialization not started")
}
pipeline := p.BasePipeline.serialize()
pipeline := p.Base.serialize()
pipeline.Runner = p.runner.String()
pipeline.AddStage(osbuild2.NewRPMStage(osbuild2.NewRPMStageOptions(p.repos), osbuild2.NewRpmStageSourceFilesInputs(p.packageSpecs)))

View file

@ -4,28 +4,28 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// OSTreeCommitPipeline represents an ostree with one commit.
type OSTreeCommitPipeline struct {
BasePipeline
// OSTreeCommit represents an ostree with one commit.
type OSTreeCommit struct {
Base
OSVersion string
treePipeline *OSPipeline
treePipeline *OS
ref string
}
// NewOSTreeCommitPipeline creates a new OSTree commit pipeline. The
// NewOSTreeCommit creates a new OSTree commit pipeline. The
// treePipeline is the tree representing the content of the commit.
// ref is the ref to create the commit under.
func NewOSTreeCommitPipeline(m *Manifest,
buildPipeline *BuildPipeline,
treePipeline *OSPipeline,
ref string) *OSTreeCommitPipeline {
p := &OSTreeCommitPipeline{
BasePipeline: NewBasePipeline(m, "ostree-commit", buildPipeline),
func NewOSTreeCommit(m *Manifest,
buildPipeline *Build,
treePipeline *OS,
ref string) *OSTreeCommit {
p := &OSTreeCommit{
Base: NewBase(m, "ostree-commit", buildPipeline),
treePipeline: treePipeline,
ref: ref,
}
if treePipeline.BasePipeline.manifest != m {
if treePipeline.Base.manifest != m {
panic("tree pipeline from different manifest")
}
buildPipeline.addDependent(p)
@ -33,15 +33,15 @@ func NewOSTreeCommitPipeline(m *Manifest,
return p
}
func (p *OSTreeCommitPipeline) getBuildPackages() []string {
func (p *OSTreeCommit) getBuildPackages() []string {
packages := []string{
"rpm-ostree",
}
return packages
}
func (p *OSTreeCommitPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *OSTreeCommit) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
if p.treePipeline.OSTree == nil {
panic("tree is not ostree")

View file

@ -8,10 +8,10 @@ import (
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
// An OSTreeCommitServerTreePipeline contains an nginx server serving
// An OSTreeCommitServer contains an nginx server serving
// an embedded ostree commit.
type OSTreeCommitServerTreePipeline struct {
BasePipeline
type OSTreeCommitServer struct {
Base
// Packages to install in addition to the ones required by the
// pipeline.
ExtraPackages []string
@ -22,31 +22,31 @@ type OSTreeCommitServerTreePipeline struct {
repos []rpmmd.RepoConfig
packageSpecs []rpmmd.PackageSpec
commitPipeline *OSTreeCommitPipeline
commitPipeline *OSTreeCommit
nginxConfigPath string
listenPort string
}
// NewOSTreeCommitServerTreePipeline creates a new pipeline. The content
// NewOSTreeCommitServer creates a new pipeline. The content
// is built from repos and packages, which must contain nginx. commitPipeline
// is a pipeline producing an ostree commit to be served. nginxConfigPath
// is the path to the main nginx config file and listenPort is the port
// nginx will be listening on.
func NewOSTreeCommitServerTreePipeline(m *Manifest,
buildPipeline *BuildPipeline,
func NewOSTreeCommitServer(m *Manifest,
buildPipeline *Build,
repos []rpmmd.RepoConfig,
commitPipeline *OSTreeCommitPipeline,
commitPipeline *OSTreeCommit,
nginxConfigPath,
listenPort string) *OSTreeCommitServerTreePipeline {
p := &OSTreeCommitServerTreePipeline{
BasePipeline: NewBasePipeline(m, "container-tree", buildPipeline),
listenPort string) *OSTreeCommitServer {
p := &OSTreeCommitServer{
Base: NewBase(m, "container-tree", buildPipeline),
repos: repos,
commitPipeline: commitPipeline,
nginxConfigPath: nginxConfigPath,
listenPort: listenPort,
Language: "en_US",
}
if commitPipeline.BasePipeline.manifest != m {
if commitPipeline.Base.manifest != m {
panic("commit pipeline from different manifest")
}
buildPipeline.addDependent(p)
@ -54,7 +54,7 @@ func NewOSTreeCommitServerTreePipeline(m *Manifest,
return p
}
func (p *OSTreeCommitServerTreePipeline) getPackageSetChain() []rpmmd.PackageSet {
func (p *OSTreeCommitServer) getPackageSetChain() []rpmmd.PackageSet {
packages := []string{"nginx"}
return []rpmmd.PackageSet{
{
@ -64,7 +64,7 @@ func (p *OSTreeCommitServerTreePipeline) getPackageSetChain() []rpmmd.PackageSet
}
}
func (p *OSTreeCommitServerTreePipeline) getBuildPackages() []string {
func (p *OSTreeCommitServer) getBuildPackages() []string {
packages := []string{
"rpm",
"rpm-ostree",
@ -72,29 +72,29 @@ func (p *OSTreeCommitServerTreePipeline) getBuildPackages() []string {
return packages
}
func (p *OSTreeCommitServerTreePipeline) getPackageSpecs() []rpmmd.PackageSpec {
func (p *OSTreeCommitServer) getPackageSpecs() []rpmmd.PackageSpec {
return p.packageSpecs
}
func (p *OSTreeCommitServerTreePipeline) serializeStart(packages []rpmmd.PackageSpec) {
func (p *OSTreeCommitServer) serializeStart(packages []rpmmd.PackageSpec) {
if len(p.packageSpecs) > 0 {
panic("double call to serializeStart()")
}
p.packageSpecs = packages
}
func (p *OSTreeCommitServerTreePipeline) serializeEnd() {
func (p *OSTreeCommitServer) serializeEnd() {
if len(p.packageSpecs) == 0 {
panic("serializeEnd() call when serialization not in progress")
}
p.packageSpecs = nil
}
func (p *OSTreeCommitServerTreePipeline) serialize() osbuild2.Pipeline {
func (p *OSTreeCommitServer) serialize() osbuild2.Pipeline {
if len(p.packageSpecs) == 0 {
panic("serialization not started")
}
pipeline := p.BasePipeline.serialize()
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild2.NewRPMStage(osbuild2.NewRPMStageOptions(p.repos), osbuild2.NewRpmStageSourceFilesInputs(p.packageSpecs)))
pipeline.AddStage(osbuild2.NewLocaleStage(&osbuild2.LocaleStageOptions{Language: p.Language}))

View file

@ -4,42 +4,42 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// An ISOPipeline represents a bootable ISO file created from an
// An ISO represents a bootable ISO file created from an
// an existing ISOTreePipeline.
type ISOPipeline struct {
BasePipeline
type ISO struct {
Base
ISOLinux bool
treePipeline *ISOTreePipeline
treePipeline *ISOTree
filename string
}
func NewISOPipeline(m *Manifest,
buildPipeline *BuildPipeline,
treePipeline *ISOTreePipeline,
filename string) *ISOPipeline {
p := &ISOPipeline{
BasePipeline: NewBasePipeline(m, "bootiso", buildPipeline),
func NewISO(m *Manifest,
buildPipeline *Build,
treePipeline *ISOTree,
filename string) *ISO {
p := &ISO{
Base: NewBase(m, "bootiso", buildPipeline),
treePipeline: treePipeline,
filename: filename,
}
buildPipeline.addDependent(p)
if treePipeline.BasePipeline.manifest != m {
if treePipeline.Base.manifest != m {
panic("tree pipeline from different manifest")
}
m.addPipeline(p)
return p
}
func (p *ISOPipeline) getBuildPackages() []string {
func (p *ISO) getBuildPackages() []string {
return []string{
"isomd5sum",
"xorriso",
}
}
func (p *ISOPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *ISO) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild2.NewXorrisofsStage(xorrisofsStageOptions(p.filename, p.treePipeline.isoLabel, p.ISOLinux), osbuild2.NewXorrisofsStagePipelineTreeInputs(p.treePipeline.Name())))
pipeline.AddStage(osbuild2.NewImplantisomd5Stage(&osbuild2.Implantisomd5StageOptions{Filename: p.filename}))

View file

@ -9,11 +9,11 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// An ISOTreePipeline represents a tree containing the anaconda installer,
// An ISOTree represents a tree containing the anaconda installer,
// configuration in terms of a kickstart file, as well as an embedded
// payload to be installed.
type ISOTreePipeline struct {
BasePipeline
type ISOTree struct {
Base
// TODO: review optional and mandatory fields and their meaning
UEFIVendor string
OSName string
@ -21,25 +21,25 @@ type ISOTreePipeline struct {
Users []blueprint.UserCustomization
Groups []blueprint.GroupCustomization
anacondaPipeline *AnacondaPipeline
anacondaPipeline *Anaconda
isoLabel string
osTreeCommit string
osTreeURL string
osTreeRef string
}
func NewISOTreePipeline(m *Manifest,
buildPipeline *BuildPipeline,
anacondaPipeline *AnacondaPipeline,
func NewISOTree(m *Manifest,
buildPipeline *Build,
anacondaPipeline *Anaconda,
osTreeCommit,
osTreeURL,
osTreeRef,
isoLabelTmpl string) *ISOTreePipeline {
isoLabelTmpl string) *ISOTree {
// TODO: replace isoLabelTmpl with more high-level properties
isoLabel := fmt.Sprintf(isoLabelTmpl, anacondaPipeline.arch)
p := &ISOTreePipeline{
BasePipeline: NewBasePipeline(m, "bootiso-tree", buildPipeline),
p := &ISOTree{
Base: NewBase(m, "bootiso-tree", buildPipeline),
anacondaPipeline: anacondaPipeline,
isoLabel: isoLabel,
osTreeCommit: osTreeCommit,
@ -47,14 +47,14 @@ func NewISOTreePipeline(m *Manifest,
osTreeRef: osTreeRef,
}
buildPipeline.addDependent(p)
if anacondaPipeline.BasePipeline.manifest != m {
if anacondaPipeline.Base.manifest != m {
panic("anaconda pipeline from different manifest")
}
m.addPipeline(p)
return p
}
func (p *ISOTreePipeline) getOSTreeCommits() []osTreeCommit {
func (p *ISOTree) getOSTreeCommits() []osTreeCommit {
return []osTreeCommit{
{
checksum: p.osTreeCommit,
@ -63,7 +63,7 @@ func (p *ISOTreePipeline) getOSTreeCommits() []osTreeCommit {
}
}
func (p *ISOTreePipeline) getBuildPackages() []string {
func (p *ISOTree) getBuildPackages() []string {
packages := []string{
"rpm-ostree",
"squashfs-tools",
@ -71,8 +71,8 @@ func (p *ISOTreePipeline) getBuildPackages() []string {
return packages
}
func (p *ISOTreePipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *ISOTree) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
kspath := "/osbuild.ks"
ostreeRepoPath := "/ostree/repo"

View file

@ -4,30 +4,30 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// An OCIContainerPipeline represents an OCI container, containing a filesystem
// An OCIContainer represents an OCI container, containing a filesystem
// tree created by another Pipeline.
type OCIContainerPipeline struct {
BasePipeline
type OCIContainer struct {
Base
Cmd []string
ExposedPorts []string
treePipeline *BasePipeline
treePipeline *Base
architecture string
filename string
}
func NewOCIContainerPipeline(m *Manifest,
buildPipeline *BuildPipeline,
treePipeline *BasePipeline,
func NewOCIContainer(m *Manifest,
buildPipeline *Build,
treePipeline *Base,
architecture,
filename string) *OCIContainerPipeline {
p := &OCIContainerPipeline{
BasePipeline: NewBasePipeline(m, "container", buildPipeline),
filename string) *OCIContainer {
p := &OCIContainer{
Base: NewBase(m, "container", buildPipeline),
treePipeline: treePipeline,
architecture: architecture,
filename: filename,
}
if treePipeline.build.BasePipeline.manifest != m {
if treePipeline.build.Base.manifest != m {
panic("tree pipeline from different manifest")
}
buildPipeline.addDependent(p)
@ -35,8 +35,8 @@ func NewOCIContainerPipeline(m *Manifest,
return p
}
func (p *OCIContainerPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *OCIContainer) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
options := &osbuild2.OCIArchiveStageOptions{
Architecture: p.architecture,
@ -56,6 +56,6 @@ func (p *OCIContainerPipeline) serialize() osbuild2.Pipeline {
return pipeline
}
func (p *OCIContainerPipeline) getBuildPackages() []string {
func (p *OCIContainer) getBuildPackages() []string {
return []string{"tar"}
}

View file

@ -24,10 +24,10 @@ type OSPipelineOSTreeParent struct {
URL string
}
// OSPipeline represents the filesystem tree of the target image. This roughly
// OS represents the filesystem tree of the target image. This roughly
// correpsonds to the root filesystem once an instance of the image is running.
type OSPipeline struct {
BasePipeline
type OS struct {
Base
// Packages to install in addition to the ones required by the
// pipeline.
ExtraBasePackages []string
@ -99,31 +99,31 @@ type OSPipeline struct {
kernelVer string
}
// NewOSPipeline creates a new OS pipeline. osTree indicates whether or not the
// NewOS creates a new OS pipeline. osTree indicates whether or not the
// system is ostree based. osTreeParent indicates (for ostree systems) what the
// parent commit is. repos are the reposotories to install RPMs from. packages
// are the depsolved pacakges to be installed into the tree. partitionTable
// represents the disk layout of the target system. kernelName is the name of the
// kernel package that will be used on the target system.
func NewOSPipeline(m *Manifest,
buildPipeline *BuildPipeline,
func NewOS(m *Manifest,
buildPipeline *Build,
platform platform.Platform,
repos []rpmmd.RepoConfig) *OSPipeline {
p := &OSPipeline{
BasePipeline: NewBasePipeline(m, "os", buildPipeline),
repos: repos,
platform: platform,
Language: "C.UTF-8",
Hostname: "localhost.localdomain",
Timezone: "UTC",
SElinux: "targeted",
repos []rpmmd.RepoConfig) *OS {
p := &OS{
Base: NewBase(m, "os", buildPipeline),
repos: repos,
platform: platform,
Language: "C.UTF-8",
Hostname: "localhost.localdomain",
Timezone: "UTC",
SElinux: "targeted",
}
buildPipeline.addDependent(p)
m.addPipeline(p)
return p
}
func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
func (p *OS) getPackageSetChain() []rpmmd.PackageSet {
packages := p.platform.GetPackages()
if p.KernelName != "" {
@ -165,7 +165,7 @@ func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
return chain
}
func (p *OSPipeline) getBuildPackages() []string {
func (p *OS) getBuildPackages() []string {
packages := p.platform.GetBuildPackages()
packages = append(packages, "rpm")
if p.OSTree != nil {
@ -178,7 +178,7 @@ func (p *OSPipeline) getBuildPackages() []string {
return packages
}
func (p *OSPipeline) getOSTreeCommits() []osTreeCommit {
func (p *OS) getOSTreeCommits() []osTreeCommit {
commits := []osTreeCommit{}
if p.OSTree != nil && p.OSTree.Parent != nil {
commits = append(commits, osTreeCommit{
@ -189,11 +189,11 @@ func (p *OSPipeline) getOSTreeCommits() []osTreeCommit {
return commits
}
func (p *OSPipeline) getPackageSpecs() []rpmmd.PackageSpec {
func (p *OS) getPackageSpecs() []rpmmd.PackageSpec {
return p.packageSpecs
}
func (p *OSPipeline) serializeStart(packages []rpmmd.PackageSpec) {
func (p *OS) serializeStart(packages []rpmmd.PackageSpec) {
if len(p.packageSpecs) > 0 {
panic("double call to serializeStart()")
}
@ -203,7 +203,7 @@ func (p *OSPipeline) serializeStart(packages []rpmmd.PackageSpec) {
}
}
func (p *OSPipeline) serializeEnd() {
func (p *OS) serializeEnd() {
if len(p.packageSpecs) == 0 {
panic("serializeEnd() call when serialization not in progress")
}
@ -211,12 +211,12 @@ func (p *OSPipeline) serializeEnd() {
p.packageSpecs = nil
}
func (p *OSPipeline) serialize() osbuild2.Pipeline {
func (p *OS) serialize() osbuild2.Pipeline {
if len(p.packageSpecs) == 0 {
panic("serialization not started")
}
pipeline := p.BasePipeline.serialize()
pipeline := p.Base.serialize()
if p.OSTree != nil && p.OSTree.Parent != nil {
pipeline.AddStage(osbuild2.NewOSTreePasswdStage("org.osbuild.source", p.OSTree.Parent.Checksum))

View file

@ -23,42 +23,42 @@ type Pipeline interface {
getInline() []string
}
// A BasePipeline represents the core functionality shared between each of the pipeline
// implementations, and the BasePipeline struct must be embedded in each of them.
type BasePipeline struct {
// A Base represents the core functionality shared between each of the pipeline
// implementations, and the Base struct must be embedded in each of them.
type Base struct {
manifest *Manifest
name string
build *BuildPipeline
build *Build
}
// Name returns the name of the pipeline. The name must be unique for a given manifest.
// Pipeline names are used to refer to pipelines either as dependencies between pipelines
// or for exporting them.
func (p BasePipeline) Name() string {
func (p Base) Name() string {
return p.name
}
func (p BasePipeline) getBuildPackages() []string {
func (p Base) getBuildPackages() []string {
return []string{}
}
func (p BasePipeline) getPackageSetChain() []rpmmd.PackageSet {
func (p Base) getPackageSetChain() []rpmmd.PackageSet {
return nil
}
func (p BasePipeline) getPackageSpecs() []rpmmd.PackageSpec {
func (p Base) getPackageSpecs() []rpmmd.PackageSpec {
return []rpmmd.PackageSpec{}
}
func (p BasePipeline) getOSTreeCommits() []osTreeCommit {
func (p Base) getOSTreeCommits() []osTreeCommit {
return []osTreeCommit{}
}
func (p BasePipeline) getInline() []string {
func (p Base) getInline() []string {
return []string{}
}
// NewBasePipeline returns a generic Pipeline object. The name is mandatory, immutable and must
// NewBase returns a generic Pipeline object. The name is mandatory, immutable and must
// be unique among all the pipelines used in a manifest, which is currently not enforced.
// The build argument is a pipeline representing a build root in which the rest of the
// pipeline is built. In order to ensure reproducibility a build pipeline must always be
@ -66,14 +66,14 @@ func (p BasePipeline) getInline() []string {
// the build host's filesystem is used as the build root. The runner specifies how to use this
// pipeline as a build pipeline, by naming the distro it contains. When the host system is used
// as a build root, then the necessary runner is autodetected.
func NewBasePipeline(m *Manifest, name string, build *BuildPipeline) BasePipeline {
p := BasePipeline{
func NewBase(m *Manifest, name string, build *Build) Base {
p := Base{
manifest: m,
name: name,
build: build,
}
if build != nil {
if build.BasePipeline.manifest != m {
if build.Base.manifest != m {
panic("build pipeline from a different manifest")
}
}
@ -82,18 +82,18 @@ func NewBasePipeline(m *Manifest, name string, build *BuildPipeline) BasePipelin
// serializeStart must be called exactly once before each call
// to serialize().
func (p BasePipeline) serializeStart([]rpmmd.PackageSpec) {
func (p Base) serializeStart([]rpmmd.PackageSpec) {
}
// serializeEnd must be called exactly once after each call to
// serialize().
func (p BasePipeline) serializeEnd() {
func (p Base) serializeEnd() {
}
// Serialize turns a given pipeline into an osbuild2.Pipeline object. This object is
// meant to be treated as opaque and not to be modified further outside of the pipeline
// package.
func (p BasePipeline) serialize() osbuild2.Pipeline {
func (p Base) serialize() osbuild2.Pipeline {
pipeline := osbuild2.Pipeline{
Name: p.name,
}

View file

@ -4,28 +4,28 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// A QCOW2Pipeline turns a raw image file into qcow2 image.
type QCOW2Pipeline struct {
BasePipeline
// A QCOW2 turns a raw image file into qcow2 image.
type QCOW2 struct {
Base
Compat string
imgPipeline *LiveImgPipeline
imgPipeline *RawImage
filename string
}
// NewQCOW2Pipeline createsa new QCOW2 pipeline. imgPipeline is the pipeline producing the
// NewQCOW2 createsa new QCOW2 pipeline. imgPipeline is the pipeline producing the
// raw image. The pipeline name is the name of the new pipeline. Filename is the name
// of the produced qcow2 image.
func NewQCOW2Pipeline(m *Manifest,
buildPipeline *BuildPipeline,
imgPipeline *LiveImgPipeline,
filename string) *QCOW2Pipeline {
p := &QCOW2Pipeline{
BasePipeline: NewBasePipeline(m, "qcow2", buildPipeline),
imgPipeline: imgPipeline,
filename: filename,
func NewQCOW2(m *Manifest,
buildPipeline *Build,
imgPipeline *RawImage,
filename string) *QCOW2 {
p := &QCOW2{
Base: NewBase(m, "qcow2", buildPipeline),
imgPipeline: imgPipeline,
filename: filename,
}
if imgPipeline.BasePipeline.manifest != m {
if imgPipeline.Base.manifest != m {
panic("live image pipeline from different manifest")
}
buildPipeline.addDependent(p)
@ -33,8 +33,8 @@ func NewQCOW2Pipeline(m *Manifest,
return p
}
func (p *QCOW2Pipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *QCOW2) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild2.NewQEMUStage(
osbuild2.NewQEMUStageOptions(p.filename,
@ -48,6 +48,6 @@ func (p *QCOW2Pipeline) serialize() osbuild2.Pipeline {
return pipeline
}
func (p *QCOW2Pipeline) getBuildPackages() []string {
func (p *QCOW2) getBuildPackages() []string {
return []string{"qemu-img"}
}

View file

@ -5,38 +5,38 @@ import (
"github.com/osbuild/osbuild-composer/internal/platform"
)
// A LiveImgPipeline represents a raw image file which can be booted in a
// A RawImage represents a raw image file which can be booted in a
// hypervisor. It is created from an existing OSPipeline.
type LiveImgPipeline struct {
BasePipeline
treePipeline *OSPipeline
type RawImage struct {
Base
treePipeline *OS
filename string
}
func NewLiveImgPipeline(m *Manifest,
buildPipeline *BuildPipeline,
treePipeline *OSPipeline,
filename string) *LiveImgPipeline {
p := &LiveImgPipeline{
BasePipeline: NewBasePipeline(m, "image", buildPipeline),
func NewRawImage(m *Manifest,
buildPipeline *Build,
treePipeline *OS,
filename string) *RawImage {
p := &RawImage{
Base: NewBase(m, "image", buildPipeline),
treePipeline: treePipeline,
filename: filename,
}
buildPipeline.addDependent(p)
if treePipeline.BasePipeline.manifest != m {
if treePipeline.Base.manifest != m {
panic("tree pipeline from different manifest")
}
m.addPipeline(p)
return p
}
func (p *LiveImgPipeline) getBuildPackages() []string {
func (p *RawImage) getBuildPackages() []string {
return p.treePipeline.PartitionTable.GetBuildPackages()
}
func (p *LiveImgPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *RawImage) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
pt := p.treePipeline.PartitionTable
if pt == nil {

View file

@ -4,23 +4,23 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// A TarPipeline represents the contents of another pipeline in a tar file
type TarPipeline struct {
BasePipeline
inputPipeline *BasePipeline
// A Tar represents the contents of another pipeline in a tar file
type Tar struct {
Base
inputPipeline *Base
filename string
}
// NewTarPipeline creates a new TarPipeline. The inputPipeline represents the
// NewTar creates a new TarPipeline. The inputPipeline represents the
// filesystem tree which will be the contents of the tar file. The pipelinename
// is the name of the pipeline. The filename is the name of the output tar file.
func NewTarPipeline(m *Manifest,
buildPipeline *BuildPipeline,
inputPipeline *BasePipeline,
func NewTar(m *Manifest,
buildPipeline *Build,
inputPipeline *Base,
pipelinename,
filename string) *TarPipeline {
p := &TarPipeline{
BasePipeline: NewBasePipeline(m, pipelinename, buildPipeline),
filename string) *Tar {
p := &Tar{
Base: NewBase(m, pipelinename, buildPipeline),
inputPipeline: inputPipeline,
filename: filename,
}
@ -32,8 +32,8 @@ func NewTarPipeline(m *Manifest,
return p
}
func (p *TarPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *Tar) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
tree := new(osbuild2.TarStageInput)
tree.Type = "org.osbuild.tree"
@ -46,6 +46,6 @@ func (p *TarPipeline) serialize() osbuild2.Pipeline {
return pipeline
}
func (p *TarPipeline) getBuildPackages() []string {
func (p *Tar) getBuildPackages() []string {
return []string{"tar"}
}

View file

@ -4,26 +4,26 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// A VMDKPipeline turns a raw image file into vmdk image.
type VMDKPipeline struct {
BasePipeline
// A VMDK turns a raw image file into vmdk image.
type VMDK struct {
Base
imgPipeline *LiveImgPipeline
imgPipeline *RawImage
filename string
}
// NewVMDKPipeline creates a new VMDK pipeline. imgPipeline is the pipeline producing the
// NewVMDK creates a new VMDK pipeline. imgPipeline is the pipeline producing the
// raw image. Filename is the name of the produced image.
func NewVMDKPipeline(m *Manifest,
buildPipeline *BuildPipeline,
imgPipeline *LiveImgPipeline,
filename string) *VMDKPipeline {
p := &VMDKPipeline{
BasePipeline: NewBasePipeline(m, "vmdk", buildPipeline),
imgPipeline: imgPipeline,
filename: filename,
func NewVMDK(m *Manifest,
buildPipeline *Build,
imgPipeline *RawImage,
filename string) *VMDK {
p := &VMDK{
Base: NewBase(m, "vmdk", buildPipeline),
imgPipeline: imgPipeline,
filename: filename,
}
if imgPipeline.BasePipeline.manifest != m {
if imgPipeline.Base.manifest != m {
panic("live image pipeline from different manifest")
}
buildPipeline.addDependent(p)
@ -31,8 +31,8 @@ func NewVMDKPipeline(m *Manifest,
return p
}
func (p *VMDKPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *VMDK) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild2.NewQEMUStage(
osbuild2.NewQEMUStageOptions(p.filename, osbuild2.QEMUFormatVMDK, osbuild2.VMDKOptions{
@ -44,6 +44,6 @@ func (p *VMDKPipeline) serialize() osbuild2.Pipeline {
return pipeline
}
func (p *VMDKPipeline) getBuildPackages() []string {
func (p *VMDK) getBuildPackages() []string {
return []string{"qemu-img"}
}

View file

@ -4,27 +4,27 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// A VPCPipeline turns a raw image file into qemu-based image format, such as qcow2.
type VPCPipeline struct {
BasePipeline
// A VPC turns a raw image file into qemu-based image format, such as qcow2.
type VPC struct {
Base
imgPipeline *LiveImgPipeline
imgPipeline *RawImage
filename string
}
// NewVPCPipeline createsa new Qemu pipeline. imgPipeline is the pipeline producing the
// NewVPC createsa new Qemu pipeline. imgPipeline is the pipeline producing the
// raw image. The pipeline name is the name of the new pipeline. Filename is the name
// of the produced image.
func NewVPCPipeline(m *Manifest,
buildPipeline *BuildPipeline,
imgPipeline *LiveImgPipeline,
filename string) *VPCPipeline {
p := &VPCPipeline{
BasePipeline: NewBasePipeline(m, "vpc", buildPipeline),
imgPipeline: imgPipeline,
filename: filename,
func NewVPC(m *Manifest,
buildPipeline *Build,
imgPipeline *RawImage,
filename string) *VPC {
p := &VPC{
Base: NewBase(m, "vpc", buildPipeline),
imgPipeline: imgPipeline,
filename: filename,
}
if imgPipeline.BasePipeline.manifest != m {
if imgPipeline.Base.manifest != m {
panic("live image pipeline from different manifest")
}
buildPipeline.addDependent(p)
@ -32,8 +32,8 @@ func NewVPCPipeline(m *Manifest,
return p
}
func (p *VPCPipeline) serialize() osbuild2.Pipeline {
pipeline := p.BasePipeline.serialize()
func (p *VPC) serialize() osbuild2.Pipeline {
pipeline := p.Base.serialize()
pipeline.AddStage(osbuild2.NewQEMUStage(
osbuild2.NewQEMUStageOptions(p.filename, osbuild2.QEMUFormatVPC, nil),
@ -43,6 +43,6 @@ func (p *VPCPipeline) serialize() osbuild2.Pipeline {
return pipeline
}
func (p *VPCPipeline) getBuildPackages() []string {
func (p *VPC) getBuildPackages() []string {
return []string{"qemu-img"}
}