Skip to content

Commit

Permalink
Handle kustomize errors in kubeconform analyse script
Browse files Browse the repository at this point in the history
Previously a failing kubectl kustomize did not fail CI job as
the error was ignored.
We now check errors from whole pipeline.
  • Loading branch information
martin-sucha committed Dec 14, 2022
1 parent 17d287b commit 12e8640
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions kubeconform/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ def analyse_overlay(overlay_dir):
stdin=p1.stdout,
)
p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits.
return_code = p2.wait()
if return_code != 0:
raise SystemExit(return_code)
p2ret = p2.wait()
if p2ret != 0:
print(f'kubeconform failed with exit code {p2ret}', file=sys.stderr)
raise SystemExit(p2ret)
p1ret = p1.wait()
if p1ret != 0:
print(f'kubectl kustomize failed with exit code {p1ret}', file=sys.stderr)
raise SystemExit(p1ret)


def analyse_k8s(dir):
Expand Down

0 comments on commit 12e8640

Please sign in to comment.