Skip to content

Commit

Permalink
Fix missing deploy event handlers in kustomize render
Browse files Browse the repository at this point in the history
Signed-off-by: Armin Buerkle <[email protected]>
  • Loading branch information
arminbuerkle committed Dec 10, 2019
1 parent 212ea60 commit ce818aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/skaffold/deploy/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ func (k *KustomizeDeployer) Labels() map[string]string {

// Deploy runs `kubectl apply` on the manifest generated by kustomize.
func (k *KustomizeDeployer) Deploy(ctx context.Context, out io.Writer, builds []build.Artifact, labellers []Labeller) *Result {
event.DeployInProgress()
manifests, err := k.renderManifests(ctx, out, builds, labellers)
if err != nil {
event.DeployFailed(err)
return NewDeployErrorResult(err)
}

if len(manifests) == 0 {
event.DeployComplete()
return NewDeploySuccessResult(nil)
}

event.DeployInProgress()

namespaces, err := manifests.CollectNamespaces()
if err != nil {
event.DeployInfoEvent(errors.Wrap(err, "could not fetch deployed resource namespace."+
Expand Down Expand Up @@ -193,7 +193,11 @@ func (k *KustomizeDeployer) Render(ctx context.Context, out io.Writer, builds []
manifestOut = bufio.NewWriter(f)
}

fmt.Fprintln(manifestOut, manifests.String())
for _, m := range manifests {
if _, err := fmt.Fprintln(manifestOut, string(m)); err != nil {
return errors.Wrap(err, "writing manifests")
}
}
return nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/skaffold/deploy/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ spec:
name: image1
- image: gcr.io/project/image2:tag2
name: image2
`,
},
}
Expand Down

0 comments on commit ce818aa

Please sign in to comment.