Adding new types and adapting copies of all the old types to match the
new Manifest schema:
New types:
- Stages
- org.osbuild.ostree.init
- org.osbuild.ostree.pull
- org.osbuild.ostree.preptree (replaces org.osbuild.rpm-ostree)
- org.osbuild.curl
- Converted from assemblers
The concept of a Build and Assembler stage in gone now. Instead they
are regular Stages like any other.
- org.osbuild.oci-archive
- org.osbuild.ostree.commit
- Sources
- org.osbuild.curl
- org.osbuild.ostree
- Inputs
- org.osbuild.files
- org.osbuild.ostree
Types with changes:
- Stages
- org.osbuild.rpm:
- New input structure for defining packages
- New options
Basically copies:
- The rest simply rename the `Name` field to `Type`
Decoding types with interface fields:
Types that contain interfaces with multiple implementations implement
their own UnmarshalJSON method. In these cases, we use a JSON decoder
with the `DisallowUnknownFields` option to catch errors during the
deserialization while trying to determine which implementation matches
the data.
Copied tests for copied types are adapted accordingly.
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
// Package osbuild provides primitives for representing and (un)marshalling
|
|
// OSBuild (schema v1) types.
|
|
package osbuild2
|
|
|
|
// A Manifest represents an OSBuild source and pipeline manifest
|
|
type Manifest struct {
|
|
Version string `json:"version"`
|
|
Pipelines []Pipeline `json:"pipelines"`
|
|
Sources Sources `json:"sources"`
|
|
}
|
|
|
|
// A Pipeline represents an OSBuild pipeline
|
|
type Pipeline struct {
|
|
Name string `json:"name,omitempty"`
|
|
// The build environment which can run this pipeline
|
|
Build string `json:"build,omitempty"`
|
|
|
|
Runner string `json:"runner,omitempty"`
|
|
|
|
// Sequence of stages that produce the filesystem tree, which is the
|
|
// payload of the produced image.
|
|
Stages []*Stage `json:"stages,omitempty"`
|
|
}
|
|
|
|
// SetBuild sets the pipeline and runner for generating the build environment
|
|
// for a pipeline.
|
|
func (p *Pipeline) SetBuild(build string) {
|
|
p.Build = build
|
|
}
|
|
|
|
// AddStage appends a stage to the list of stages of a pipeline. The stages
|
|
// will be executed in the order they are appended.
|
|
func (p *Pipeline) AddStage(stage *Stage) {
|
|
p.Stages = append(p.Stages, stage)
|
|
}
|