Skip to content

Commit

Permalink
Skip trying to create empty manifest tar
Browse files Browse the repository at this point in the history
If there are no manifests we generate the following errors:

tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.
command terminated with exit code 123
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
I, [2022-03-21T20:10:18.349339 compumike#1]  INFO -- : No JSONs to retrieve. Skipping

Skip calling tar if no manifests are found.
  • Loading branch information
salimepoint committed Mar 22, 2022
1 parent 147c58b commit 4d4da58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fetch_manifests
@_manifest_tmpdir = File.join("/dev/shm", SecureRandom.hex)
FileUtils.mkdir(@_manifest_tmpdir)

Open3.pipeline(["kubectl", "exec", "-n", TROW_NAMESPACE, TROW_POD, "--", "/bin/bash", "-c", "find /data/manifests/ -type f -print0 | xargs -0 tar -cf -"],
Open3.pipeline(["kubectl", "exec", "-n", TROW_NAMESPACE, TROW_POD, "--", "/bin/bash", "-c", "find /data/manifests/ -type f -print0 | xargs --no-run-if-empty -0 tar -cf -"],
["tar", "-C", @_manifest_tmpdir, "-xf", "-"])
end

Expand Down

0 comments on commit 4d4da58

Please sign in to comment.