debian-forge-composer/internal/pipeline/commit.go
Tom Gundersen ae34513d18 pipeline: move package to top level
The pipeline package is exists conceptually between the distro and the osbuild packages, so move
it to the top level rather than as a child of distro.

No functional change.
2022-06-27 19:11:26 +01:00

48 lines
1.2 KiB
Go

package pipeline
import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
type OSTreeCommitPipeline struct {
Pipeline
treePipeline *OSPipeline
OSVersion string
Parent string
ref string
}
func NewOSTreeCommitPipeline(buildPipeline *BuildPipeline, treePipeline *OSPipeline, ref string) OSTreeCommitPipeline {
return OSTreeCommitPipeline{
Pipeline: New("ostree-commit", buildPipeline, nil),
treePipeline: treePipeline,
ref: ref,
}
}
func (p OSTreeCommitPipeline) Ref() string {
return p.ref
}
func (p OSTreeCommitPipeline) Serialize() osbuild2.Pipeline {
pipeline := p.Pipeline.Serialize()
pipeline.AddStage(osbuild2.NewOSTreeInitStage(&osbuild2.OSTreeInitStageOptions{Path: "/repo"}))
commitStageInput := new(osbuild2.OSTreeCommitStageInput)
commitStageInput.Type = "org.osbuild.tree"
commitStageInput.Origin = "org.osbuild.pipeline"
commitStageInput.References = osbuild2.OSTreeCommitStageReferences{"name:" + p.treePipeline.Name()}
pipeline.AddStage(osbuild2.NewOSTreeCommitStage(
&osbuild2.OSTreeCommitStageOptions{
Ref: p.Ref(),
OSVersion: p.OSVersion,
Parent: p.Parent,
},
&osbuild2.OSTreeCommitStageInputs{Tree: commitStageInput}),
)
return pipeline
}