Separate ostree ref from parent spec in Pipelines and ImageKinds

In the OS pipeline, the parent configuration was used to detect if the
pipeline's setup was meant for an ostree commit or not.  Also, the
pipeline used a new type to specify the ostree parameters.

- Use the ostree.CommitSpec for the parent configuration.
- Add a new attribute, OSTreeRef, that defines the ref for the ostree
  commit being built.  An empty string indicates that the tree is not
  for an ostree commit.

Additionally, in the ImageKind configurations for the ostree archive and
container, separate the ostree ref from the parent spec, make the parent
spec optional (pointer) and the ostree ref mandatory, by requiring it in
the constructor of the ImageKind.
This commit is contained in:
Achilleas Koutsou 2022-09-30 16:10:40 +02:00 committed by Tomáš Hozza
parent 390ae15eaa
commit 99952afbd4
5 changed files with 40 additions and 48 deletions

View file

@ -6,6 +6,7 @@ import (
"github.com/osbuild/osbuild-composer/internal/artifact"
"github.com/osbuild/osbuild-composer/internal/environment"
"github.com/osbuild/osbuild-composer/internal/manifest"
"github.com/osbuild/osbuild-composer/internal/ostree"
"github.com/osbuild/osbuild-composer/internal/platform"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/runner"
@ -18,15 +19,16 @@ type OSTreeArchive struct {
OSCustomizations manifest.OSCustomizations
Environment environment.Environment
Workload workload.Workload
OSTreeParent manifest.OSTree
OSTreeParent *ostree.CommitSpec
OSTreeRef string
OSVersion string
Filename string
}
func NewOSTreeArchive() *OSTreeArchive {
func NewOSTreeArchive(ref string) *OSTreeArchive {
return &OSTreeArchive{
Base: NewBase("ostree-archive"),
Base: NewBase("ostree-archive"),
OSTreeRef: ref,
}
}
@ -41,7 +43,8 @@ func (img *OSTreeArchive) InstantiateManifest(m *manifest.Manifest,
osPipeline.OSCustomizations = img.OSCustomizations
osPipeline.Environment = img.Environment
osPipeline.Workload = img.Workload
osPipeline.OSTree = &img.OSTreeParent
osPipeline.OSTreeParent = img.OSTreeParent
osPipeline.OSTreeRef = img.OSTreeRef
ostreeCommitPipeline := manifest.NewOSTreeCommit(m, buildPipeline, osPipeline, img.OSTreeRef)
ostreeCommitPipeline.OSVersion = img.OSVersion

View file

@ -6,6 +6,7 @@ import (
"github.com/osbuild/osbuild-composer/internal/artifact"
"github.com/osbuild/osbuild-composer/internal/environment"
"github.com/osbuild/osbuild-composer/internal/manifest"
"github.com/osbuild/osbuild-composer/internal/ostree"
"github.com/osbuild/osbuild-composer/internal/platform"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/runner"
@ -18,17 +19,18 @@ type OSTreeContainer struct {
OSCustomizations manifest.OSCustomizations
Environment environment.Environment
Workload workload.Workload
OSTreeParent manifest.OSTree
OSTreeRef string // TODO: merge into the above
OSTreeRef string
OSTreeParent *ostree.CommitSpec
OSVersion string
ExtraContainerPackages rpmmd.PackageSet
ContainerLanguage string
Filename string
}
func NewOSTreeContainer() *OSTreeContainer {
func NewOSTreeContainer(ref string) *OSTreeContainer {
return &OSTreeContainer{
Base: NewBase("ostree-container"),
Base: NewBase("ostree-container"),
OSTreeRef: ref,
}
}
@ -43,7 +45,8 @@ func (img *OSTreeContainer) InstantiateManifest(m *manifest.Manifest,
osPipeline.OSCustomizations = img.OSCustomizations
osPipeline.Environment = img.Environment
osPipeline.Workload = img.Workload
osPipeline.OSTree = &img.OSTreeParent
osPipeline.OSTreeRef = img.OSTreeRef
osPipeline.OSTreeParent = img.OSTreeParent
commitPipeline := manifest.NewOSTreeCommit(m, buildPipeline, osPipeline, img.OSTreeRef)
commitPipeline.OSVersion = img.OSVersion