Skip to content

kustomize build fails silently when first line is invalid yaml #4861

@gilbahat

Description

@gilbahat

when encountering a malformed kustomization.yaml file which is due to poor definition, kustomize will silently create an empty yaml file instead of reporting an error:

(note the two spaces at the beginning of the yaml file!)

✗ head infrastructure/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
(... snipped ...)

✗ kustomize build infrastructure -o test.yaml
✗ ls -l test.yaml
-rw-r--r-- 1 gilbahat staff 0 Nov 10 14:06 test.yaml

this is unlike other error modes which output usable error messages and do not generate an empty yaml file, e.g.:

✗ kustomize build infrastructure -o test.yaml
Error: accumulating resources: accumulation err='accumulating resources from (... snipped ...)
✗ ls -l test.yaml
ls: test.yaml: No such file or directory

Metadata

Metadata

Assignees

Labels

area/yaml-upstreamIssues root caused to gopkg.in/yamlkind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions