osbuild: add support for org.osbuild.container inputs
Add bindings for `org.osbuild.conainer` inputs which can be used to supply containers to stages. Currently only fetching containers via sources is supported.
This commit is contained in:
parent
513ae6d3d0
commit
718b0c0c32
1 changed files with 46 additions and 0 deletions
46
internal/osbuild/containers_input.go
Normal file
46
internal/osbuild/containers_input.go
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package osbuild
|
||||
|
||||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/container"
|
||||
)
|
||||
|
||||
type ContainersInputReferences interface {
|
||||
isContainersInputReferences()
|
||||
}
|
||||
|
||||
type ContainersInputSourceRef struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
type ContainersInputSourceMap map[string]ContainersInputSourceRef
|
||||
|
||||
func (ContainersInputSourceMap) isContainersInputReferences() {}
|
||||
|
||||
type ContainersInput struct {
|
||||
inputCommon
|
||||
References ContainersInputReferences `json:"references"`
|
||||
}
|
||||
|
||||
const InputTypeContainers string = "org.osbuild.containers"
|
||||
|
||||
func NewContainersInputForSources(containers []container.Spec) ContainersInput {
|
||||
refs := make(ContainersInputSourceMap, len(containers))
|
||||
for _, c := range containers {
|
||||
ref := ContainersInputSourceRef{
|
||||
Name: c.LocalName,
|
||||
}
|
||||
refs[c.ImageID] = ref
|
||||
}
|
||||
|
||||
return ContainersInput{
|
||||
References: refs,
|
||||
inputCommon: inputCommon{
|
||||
Type: InputTypeContainers,
|
||||
Origin: InputOriginSource,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type ContainersInputs map[string]ContainersInput
|
||||
|
||||
func (c ContainersInputs) isStageInputs() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue