Skip to content

Commit

Permalink
output all manifests in one string with yaml separators
Browse files Browse the repository at this point in the history
  • Loading branch information
nkubala committed Oct 2, 2019
1 parent c563762 commit f4b9430
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions integration/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ spec:
containers:
- image: gcr.io/k8s-skaffold/skaffold:test
name: skaffold
`,
},
{
Expand Down Expand Up @@ -92,7 +91,6 @@ spec:
name: image1
- image: gcr.io/project/image2:tag2
name: image2
`,
},
{
Expand Down Expand Up @@ -129,7 +127,7 @@ spec:
containers:
- image: gcr.io/project/image1:tag1
name: image1
---
apiVersion: v1
kind: Pod
metadata:
Expand All @@ -138,7 +136,6 @@ spec:
containers:
- image: gcr.io/project/image2:tag2
name: image2
`,
},
}
Expand Down
7 changes: 5 additions & 2 deletions pkg/skaffold/deploy/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,13 @@ func (k *KubectlDeployer) Render(ctx context.Context, out io.Writer, builds []bu
manifestOut = bufio.NewWriter(f)
}

for _, m := range manifests {
if _, err := fmt.Fprintln(manifestOut, string(m)); err != nil {
for i := 0; i < len(manifests); i++ {
if _, err := fmt.Fprintf(manifestOut, string(manifests[i])); err != nil {
return errors.Wrap(err, "writing manifests")
}
if i < len(manifests)-1 {
fmt.Fprintf(manifestOut, "---\n")
}
}
return nil
}
Expand Down

0 comments on commit f4b9430

Please sign in to comment.