- Remove stage-specific input types when they are org.osbuild.tree input types. - Use PipelineTreeInputs when stage requires a single tree input reference with an arbitrary key. - For Stages that require a specific key with a tree input, make the key part of the NewXStage() function and only allow specifying the name of the pipeline from which to copy the tree as part of the function arguments.
66 lines
1.5 KiB
Go
66 lines
1.5 KiB
Go
package manifest
|
|
|
|
import (
|
|
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
|
)
|
|
|
|
// OSTreeCommit represents an ostree with one commit.
|
|
type OSTreeCommit struct {
|
|
Base
|
|
OSVersion string
|
|
|
|
treePipeline *OS
|
|
ref string
|
|
}
|
|
|
|
// 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 NewOSTreeCommit(m *Manifest,
|
|
buildPipeline *Build,
|
|
treePipeline *OS,
|
|
ref string) *OSTreeCommit {
|
|
p := &OSTreeCommit{
|
|
Base: NewBase(m, "ostree-commit", buildPipeline),
|
|
treePipeline: treePipeline,
|
|
ref: ref,
|
|
}
|
|
if treePipeline.Base.manifest != m {
|
|
panic("tree pipeline from different manifest")
|
|
}
|
|
buildPipeline.addDependent(p)
|
|
m.addPipeline(p)
|
|
return p
|
|
}
|
|
|
|
func (p *OSTreeCommit) getBuildPackages() []string {
|
|
packages := []string{
|
|
"rpm-ostree",
|
|
}
|
|
return packages
|
|
}
|
|
|
|
func (p *OSTreeCommit) serialize() osbuild.Pipeline {
|
|
pipeline := p.Base.serialize()
|
|
|
|
if p.treePipeline.OSTree == nil {
|
|
panic("tree is not ostree")
|
|
}
|
|
|
|
pipeline.AddStage(osbuild.NewOSTreeInitStage(&osbuild.OSTreeInitStageOptions{Path: "/repo"}))
|
|
|
|
var parent string
|
|
if p.treePipeline.OSTree.Parent != nil {
|
|
parent = p.treePipeline.OSTree.Parent.Checksum
|
|
}
|
|
pipeline.AddStage(osbuild.NewOSTreeCommitStage(
|
|
&osbuild.OSTreeCommitStageOptions{
|
|
Ref: p.ref,
|
|
OSVersion: p.OSVersion,
|
|
Parent: parent,
|
|
},
|
|
p.treePipeline.Name()),
|
|
)
|
|
|
|
return pipeline
|
|
}
|