From 2f01ab25ed30dfcec40b0ef13224611881e9b88c Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 14 Sep 2017 16:59:49 +0100 Subject: [PATCH 1/2] Correct example yaml Without the space I get: FATA[0000] Invalid config: yaml: line 66: could not find expected ':' Signed-off-by: Ian Campbell --- docs/yaml.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/yaml.md b/docs/yaml.md index 1bbe72451..b8993b259 100644 --- a/docs/yaml.md +++ b/docs/yaml.md @@ -110,7 +110,7 @@ supported here is `"yaml"` which will output the yaml used to generate the image file: ``` - path: etc/linuxkit.yml - metadata:yaml + metadata: yaml ``` ## `trust` From 411a21ae07f8dafa9a6c9dbd13599f93bed5e91c Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 14 Sep 2017 17:04:41 +0100 Subject: [PATCH 2/2] Make "metadata: yaml" actually output yaml The existing code made json... Signed-off-by: Ian Campbell --- src/moby/build.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/moby/build.go b/src/moby/build.go index 33a7a2988..b79dca259 100644 --- a/src/moby/build.go +++ b/src/moby/build.go @@ -15,6 +15,7 @@ import ( "strings" log "github.com/Sirupsen/logrus" + "gopkg.in/yaml.v2" ) const defaultNameForStdin = "moby" @@ -389,8 +390,10 @@ func tarAppend(iw *tar.Writer, tr *tar.Reader) error { // this allows inserting metadata into a file in the image func metadata(m Moby, md string) ([]byte, error) { switch md { - case "yaml": + case "json": return json.MarshalIndent(m, "", " ") + case "yaml": + return yaml.Marshal(m) default: return []byte{}, fmt.Errorf("Unsupported metadata type: %s", md) }