From be4b52577468c45a735ca5304d309e032e464f72 Mon Sep 17 00:00:00 2001
From: Damien Grisonnet <dgrisonn@redhat.com>
Date: Fri, 17 Apr 2020 12:41:43 +0200
Subject: [PATCH] build.sh: fix json files cleanup

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
---
 README.md | 8 ++++++--
 build.sh  | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index afc40aa3..ed9115b1 100644
--- a/README.md
+++ b/README.md
@@ -243,8 +243,12 @@ PATH="$(pwd)/tmp/bin:${PATH}"
 rm -rf manifests
 mkdir -p manifests/setup
 
-                                               # optional, but we would like to generate yaml, not json
-jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml; rm -f {}' -- {}
+# Calling gojsontoyaml is optional, but we would like to generate yaml, not json
+jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
+
+# Make sure to remove json files
+find manifests -type f ! -name '*.yaml' -delete
+rm kustomization
 
 ```
 
diff --git a/build.sh b/build.sh
index a61af846..9f048017 100755
--- a/build.sh
+++ b/build.sh
@@ -14,6 +14,10 @@ PATH="$(pwd)/tmp/bin:${PATH}"
 rm -rf manifests
 mkdir -p manifests/setup
 
-                                               # optional, but we would like to generate yaml, not json
-jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml; rm -f {}' -- {}
+# Calling gojsontoyaml is optional, but we would like to generate yaml, not json
+jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
+
+# Make sure to remove json files
+find manifests -type f ! -name '*.yaml' -delete
+rm kustomization
 
-- 
GitLab