debian-forge-composer/internal/osbuild/tree_input.go
Achilleas Koutsou ca0175c82b osbuild: function for creating named pipeline tree inputs
Convenience function for creating a map with a single input pointing to
a pipeline's tree with a given key.
Different stages use different keys in the map (often "tree").
Functions will be added for each stage to create a map with the
appropriate key when necessary.
2022-09-29 18:09:38 +02:00

30 lines
788 B
Go

package osbuild
// Tree inputs
type TreeInput struct {
inputCommon
References []string `json:"references"`
}
func (TreeInput) isInput() {}
// NewTreeInput creates an org.osbuild.tree input for an osbuild stage.
// The input is the final tree from a pipeline that should be referenced as
// 'name:<pipelinename>' in the reference argument.
func NewTreeInput(reference string) *TreeInput {
input := new(TreeInput)
input.Type = "org.osbuild.tree"
input.Origin = "org.osbuild.pipeline"
input.References = []string{reference}
return input
}
type PipelineTreeInputs map[string]TreeInput
func NewPipelineTreeInputs(name, pipeline string) *PipelineTreeInputs {
return &PipelineTreeInputs{
name: *NewTreeInput("name:" + pipeline),
}
}
func (PipelineTreeInputs) isStageInputs() {}