Skip to content

Commit

Permalink
Cause debug to skip unmarshallable yamls (#3326)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Dec 18, 2019
1 parent f408bce commit e0d2ae8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/skaffold/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ func applyDebuggingTransforms(l kubectl.ManifestList, retriever configurationRet
for _, manifest := range l {
obj, _, err := decodeFromYaml(manifest, nil, nil)
if err != nil {
return nil, errors.Wrap(err, "reading Kubernetes YAML")
}

if transformManifest(obj, retriever) {
logrus.Debugf("Unable to interpret manifest for debugging: %v\n", err)
} else if transformManifest(obj, retriever) {
manifest, err = encodeAsYaml(obj)
if err != nil {
return nil, errors.Wrap(err, "marshalling yaml")
Expand Down
22 changes: 22 additions & 0 deletions pkg/skaffold/debug/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,28 @@ spec:
status:
replicas: 0`,
},
{
description: "skip unhandled yamls like crds",
shouldErr: false,
in: `---
apiVersion: openfaas.com/v1alpha2
kind: Function
metadata:
name: myfunction
namespace: openfaas-fn
spec:
name: myfunction
image: myfunction`,
out: `---
apiVersion: openfaas.com/v1alpha2
kind: Function
metadata:
name: myfunction
namespace: openfaas-fn
spec:
name: myfunction
image: myfunction`,
},
}
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
Expand Down

0 comments on commit e0d2ae8

Please sign in to comment.