From c0e55915199c8e3070dc9834c5e7038c1c6e12ea Mon Sep 17 00:00:00 2001 From: Simon de Vlieger Date: Wed, 13 Dec 2023 11:44:30 +0100 Subject: [PATCH] stage(skopeo): introduce oci --- pkg/osbuild/skopeo_stage.go | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/pkg/osbuild/skopeo_stage.go b/pkg/osbuild/skopeo_stage.go index a4156733aa..83c550a3c0 100644 --- a/pkg/osbuild/skopeo_stage.go +++ b/pkg/osbuild/skopeo_stage.go @@ -1,13 +1,26 @@ package osbuild +type SkopeoDestination interface { + isSkopeoDestination() +} + type SkopeoDestinationContainersStorage struct { Type string `json:"type"` StoragePath string `json:"storage-path,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 { - DestinationContainersStorage SkopeoDestinationContainersStorage `json:"destination"` + Destination SkopeoDestination `json:"destination"` } func (o SkopeoStageOptions) isStageOptions() {} @@ -29,7 +42,7 @@ func NewSkopeoStageWithContainersStorage(path string, images ContainersInput, ma return &Stage{ Type: "org.osbuild.skopeo", Options: &SkopeoStageOptions{ - DestinationContainersStorage: SkopeoDestinationContainersStorage{ + Destination: SkopeoDestinationContainersStorage{ Type: "containers-storage", StoragePath: path, }, @@ -37,3 +50,21 @@ func NewSkopeoStageWithContainersStorage(path string, images ContainersInput, ma 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, + } +}