diff --git a/pkg/manifest/os.go b/pkg/manifest/os.go index 2e03174668..c2dd8f248d 100644 --- a/pkg/manifest/os.go +++ b/pkg/manifest/os.go @@ -417,7 +417,7 @@ func (p *OS) serialize() osbuild.Pipeline { } manifests := osbuild.NewFilesInputForManifestLists(p.containerSpecs) - skopeo := osbuild.NewSkopeoStage(storagePath, images, manifests) + skopeo := osbuild.NewSkopeoStageWithContainersStorage(storagePath, images, manifests) pipeline.AddStage(skopeo) } diff --git a/pkg/osbuild/skopeo_stage.go b/pkg/osbuild/skopeo_stage.go index 7efa70ba9c..83c550a3c0 100644 --- a/pkg/osbuild/skopeo_stage.go +++ b/pkg/osbuild/skopeo_stage.go @@ -1,11 +1,24 @@ package osbuild -type SkopeoDestination struct { +type SkopeoDestination interface { + isSkopeoDestination() +} + +type SkopeoDestinationContainersStorage struct { Type string `json:"type"` StoragePath string `json:"storage-path,omitempty"` - StorageDriver string `json:"sotrage-driver,omitempty"` + StorageDriver string `json:"storage-driver,omitempty"` +} + +func (SkopeoDestinationContainersStorage) isSkopeoDestination() {} + +type SkopeoDestinationOCI struct { + Type string `json:"type"` + Path string `json:"path,omitempty"` } +func (SkopeoDestinationOCI) isSkopeoDestination() {} + type SkopeoStageOptions struct { Destination SkopeoDestination `json:"destination"` } @@ -19,7 +32,7 @@ type SkopeoStageInputs struct { func (SkopeoStageInputs) isStageInputs() {} -func NewSkopeoStage(path string, images ContainersInput, manifests *FilesInput) *Stage { +func NewSkopeoStageWithContainersStorage(path string, images ContainersInput, manifests *FilesInput) *Stage { inputs := SkopeoStageInputs{ Images: images, @@ -29,7 +42,7 @@ func NewSkopeoStage(path string, images ContainersInput, manifests *FilesInput) return &Stage{ Type: "org.osbuild.skopeo", Options: &SkopeoStageOptions{ - Destination: SkopeoDestination{ + Destination: SkopeoDestinationContainersStorage{ Type: "containers-storage", StoragePath: path, }, @@ -37,3 +50,21 @@ func NewSkopeoStage(path string, images ContainersInput, manifests *FilesInput) Inputs: inputs, } } + +func NewSkopeoStageWithOCI(path string, images ContainersInput, manifests *FilesInput) *Stage { + inputs := SkopeoStageInputs{ + Images: images, + ManifestLists: manifests, + } + + return &Stage{ + Type: "org.osbuild.skopeo", + Options: &SkopeoStageOptions{ + Destination: &SkopeoDestinationOCI{ + Type: "oci", + Path: path, + }, + }, + Inputs: inputs, + } +}