Skip to content

Commit

Permalink
Merge pull request #538 from dgageot/ignore-empty-manifests
Browse files Browse the repository at this point in the history
Ignore empty manifests
  • Loading branch information
dgageot authored May 11, 2018
2 parents 3c521be + 0106cc7 commit d0479f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/skaffold/deploy/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ func (k *KubectlDeployer) readManifests() (manifestList, error) {
manifests = append(manifests, manifest)
}

logrus.Debugln("manifests", manifests.String())

return manifests, nil
}

Expand Down Expand Up @@ -293,6 +295,10 @@ func (l *manifestList) replaceImages(b []build.Build) (manifestList, error) {
return nil, errors.Wrap(err, "reading kubernetes YAML")
}

if len(m) == 0 {
continue
}

recursiveReplaceImage(m, replacements)

updatedManifest, err := yaml.Marshal(m)
Expand All @@ -309,6 +315,8 @@ func (l *manifestList) replaceImages(b []build.Build) (manifestList, error) {
}
}

logrus.Debugln("manifests with tagged images", updatedManifests.String())

return updatedManifests, nil
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/skaffold/deploy/kubectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ func TestKubectlCleanup(t *testing.T) {
})
}
}

func TestReplaceImages(t *testing.T) {
var tests = []struct {
description string
Expand Down Expand Up @@ -248,6 +249,11 @@ spec:
- image: gcr.io/k8s-skaffold/skaffold-example:TAG
name: getting-started`)},
},
{
description: "empty",
manifests: manifestList{[]byte(""), []byte(" ")},
expectedManifests: manifestList{},
},
{
description: "ignore tag",
builds: []build.Build{{
Expand Down

0 comments on commit d0479f9

Please sign in to comment.