mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
Split out OCI generation function
This is to make unit testing easier for #1481 Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
4d9bd63b1b
commit
493aeaa78d
@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
@ -76,7 +77,6 @@ func NewConfig(config []byte) (*Moby, error) {
|
||||
|
||||
// ConfigToOCI converts a config specification to an OCI config file
|
||||
func ConfigToOCI(image *MobyImage) ([]byte, error) {
|
||||
oci := specs.Spec{}
|
||||
|
||||
// TODO pass through same docker client to all functions
|
||||
cli, err := dockerClient()
|
||||
@ -89,6 +89,13 @@ func ConfigToOCI(image *MobyImage) ([]byte, error) {
|
||||
return []byte{}, err
|
||||
}
|
||||
|
||||
return ConfigInspectToOCI(image, inspect)
|
||||
}
|
||||
|
||||
// ConfigInspectToOCI converts a config and the output of image inspect to an OCI config file
|
||||
func ConfigInspectToOCI(image *MobyImage, inspect types.ImageInspect) ([]byte, error) {
|
||||
oci := specs.Spec{}
|
||||
|
||||
config := inspect.Config
|
||||
if config == nil {
|
||||
return []byte{}, errors.New("empty image config")
|
||||
|
Loading…
Reference in New Issue
Block a user