|
Packit |
63bb0d |
// Package osbuild provides primitives for representing and (un)marshalling
|
|
Packit |
63bb0d |
// OSBuild types.
|
|
Packit |
63bb0d |
package osbuild
|
|
Packit |
63bb0d |
|
|
Packit |
63bb0d |
// A Manifest represents an OSBuild source and pipeline manifest
|
|
Packit |
63bb0d |
type Manifest struct {
|
|
Packit |
63bb0d |
Sources Sources `json:"sources"`
|
|
Packit |
63bb0d |
Pipeline Pipeline `json:"pipeline"`
|
|
Packit |
63bb0d |
}
|
|
Packit |
63bb0d |
|
|
Packit |
63bb0d |
// A Pipeline represents an OSBuild pipeline
|
|
Packit |
63bb0d |
type Pipeline struct {
|
|
Packit |
63bb0d |
// The build environment which can run this pipeline
|
|
Packit |
63bb0d |
Build *Build `json:"build,omitempty"`
|
|
Packit |
63bb0d |
// Sequence of stages that produce the filesystem tree, which is the
|
|
Packit |
63bb0d |
// payload of the produced image.
|
|
Packit |
63bb0d |
Stages []*Stage `json:"stages,omitempty"`
|
|
Packit |
63bb0d |
// Assembler that assembles the filesystem tree into the target image.
|
|
Packit |
63bb0d |
Assembler *Assembler `json:"assembler,omitempty"`
|
|
Packit |
63bb0d |
}
|
|
Packit |
63bb0d |
|
|
Packit |
63bb0d |
type Build struct {
|
|
Packit |
63bb0d |
// Pipeline describes how to create the build root
|
|
Packit |
63bb0d |
Pipeline *Pipeline `json:"pipeline"`
|
|
Packit |
63bb0d |
// The runner to use in this build root
|
|
Packit |
63bb0d |
Runner string `json:"runner"`
|
|
Packit |
63bb0d |
}
|
|
Packit |
63bb0d |
|
|
Packit |
63bb0d |
// SetBuild sets the pipeline and runner for generating the build environment
|
|
Packit |
63bb0d |
// for a pipeline.
|
|
Packit |
63bb0d |
func (p *Pipeline) SetBuild(pipeline *Pipeline, runner string) {
|
|
Packit |
63bb0d |
p.Build = &Build{
|
|
Packit |
63bb0d |
Pipeline: pipeline,
|
|
Packit |
63bb0d |
Runner: runner,
|
|
Packit |
63bb0d |
}
|
|
Packit |
63bb0d |
}
|
|
Packit |
63bb0d |
|
|
Packit |
63bb0d |
// AddStage appends a stage to the list of stages of a pipeline. The stages
|
|
Packit |
63bb0d |
// will be executed in the order they are appended.
|
|
Packit |
63bb0d |
func (p *Pipeline) AddStage(stage *Stage) {
|
|
Packit |
63bb0d |
p.Stages = append(p.Stages, stage)
|
|
Packit |
63bb0d |
}
|
|
Packit |
63bb0d |
|
|
Packit |
63bb0d |
// SetAssembler sets the assembler for a pipeline.
|
|
Packit |
63bb0d |
func (p *Pipeline) SetAssembler(assembler *Assembler) {
|
|
Packit |
63bb0d |
p.Assembler = assembler
|
|
Packit |
63bb0d |
}
|