diff --git a/internal/plugin/runtime_subprocess.go b/internal/plugin/runtime_subprocess.go index c836c1c6d..1d47ba745 100644 --- a/internal/plugin/runtime_subprocess.go +++ b/internal/plugin/runtime_subprocess.go @@ -255,7 +255,7 @@ func (r *SubprocessPluginRuntime) runPostrenderer(input *Input) (*Output, error) go func() { defer stdin.Close() - io.Copy(stdin, msg.Manifests) + io.Copy(stdin, bytes.NewBufferString(msg.Manifests)) }() postRendered := &bytes.Buffer{} @@ -272,7 +272,7 @@ func (r *SubprocessPluginRuntime) runPostrenderer(input *Input) (*Output, error) return &Output{ Message: schema.OutputMessagePostRendererV1{ - Manifests: postRendered, + Manifests: postRendered.String(), }, }, nil } diff --git a/internal/plugin/schema/postrenderer.go b/internal/plugin/schema/postrenderer.go index ef51a8a61..cda29b4b2 100644 --- a/internal/plugin/schema/postrenderer.go +++ b/internal/plugin/schema/postrenderer.go @@ -16,19 +16,15 @@ limitations under the License. package schema -import ( - "bytes" -) - // InputMessagePostRendererV1 implements Input.Message type InputMessagePostRendererV1 struct { - Manifests *bytes.Buffer `json:"manifests"` + Manifests string `json:"manifests"` // from CLI --post-renderer-args ExtraArgs []string `json:"extraArgs"` } type OutputMessagePostRendererV1 struct { - Manifests *bytes.Buffer `json:"manifests"` + Manifests string `json:"manifests"` } type ConfigPostRendererV1 struct{} diff --git a/pkg/postrenderer/postrenderer.go b/pkg/postrenderer/postrenderer.go index 55e6d3adf..e37ffb3f8 100644 --- a/pkg/postrenderer/postrenderer.go +++ b/pkg/postrenderer/postrenderer.go @@ -64,7 +64,7 @@ func (r *postRendererPlugin) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer input := &plugin.Input{ Message: schema.InputMessagePostRendererV1{ ExtraArgs: r.args, - Manifests: renderedManifests, + Manifests: renderedManifests.String(), }, } output, err := r.plugin.Invoke(context.Background(), input) @@ -76,9 +76,9 @@ func (r *postRendererPlugin) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer // If the binary returned almost nothing, it's likely that it didn't // successfully render anything - if len(bytes.TrimSpace(outputMessage.Manifests.Bytes())) == 0 { + if len(bytes.TrimSpace([]byte(outputMessage.Manifests))) == 0 { return nil, fmt.Errorf("post-renderer %q produced empty output", r.plugin.Metadata().Name) } - return outputMessage.Manifests, nil + return bytes.NewBufferString(outputMessage.Manifests), nil }