Skip to content

Commit

Permalink
stage(skopeo): introduce oci
Browse files Browse the repository at this point in the history
  • Loading branch information
supakeen authored and achilleas-k committed Dec 15, 2023
1 parent a94b711 commit c0e5591
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions pkg/osbuild/skopeo_stage.go
Original file line number Diff line number Diff line change
@@ -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() {}
Expand All @@ -29,11 +42,29 @@ func NewSkopeoStageWithContainersStorage(path string, images ContainersInput, ma
return &Stage{
Type: "org.osbuild.skopeo",
Options: &SkopeoStageOptions{
DestinationContainersStorage: SkopeoDestinationContainersStorage{
Destination: SkopeoDestinationContainersStorage{
Type: "containers-storage",
StoragePath: path,
},
},
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,
}
}

0 comments on commit c0e5591

Please sign in to comment.