From cbb03d387c3ff2e3f9634a0c75649cdac4be2b9e Mon Sep 17 00:00:00 2001
From: Max Leonard Inden <IndenML@gmail.com>
Date: Thu, 16 Aug 2018 11:07:36 +0200
Subject: [PATCH] *.sh: Set sane bash options on shell scripts

Adding the following accross the project:

```bash
/# exit immediately when a command fails
set -e
/# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
/# error on unset variables
+set -u

```
---
 experimental/custom-metrics-api/gencerts.sh | 6 ++++++
 hack/example-service-monitoring/deploy      | 6 ++++++
 hack/example-service-monitoring/teardown    | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/experimental/custom-metrics-api/gencerts.sh b/experimental/custom-metrics-api/gencerts.sh
index b1e16031..a8f5539d 100755
--- a/experimental/custom-metrics-api/gencerts.sh
+++ b/experimental/custom-metrics-api/gencerts.sh
@@ -1,4 +1,10 @@
 #!/usr/bin/env bash
+# exit immediately when a command fails
+set -e
+# only exit with zero if all commands of the pipeline exit successfully
+set -o pipefail
+# error on unset variables
+set -u
 
 # Detect if we are on mac or should use GNU base64 options
 case $(uname) in
diff --git a/hack/example-service-monitoring/deploy b/hack/example-service-monitoring/deploy
index 4912dd96..0c7cd7c1 100755
--- a/hack/example-service-monitoring/deploy
+++ b/hack/example-service-monitoring/deploy
@@ -1,3 +1,9 @@
 #!/usr/bin/env bash
+# exit immediately when a command fails
+set -e
+# only exit with zero if all commands of the pipeline exit successfully
+set -o pipefail
+# error on unset variables
+set -u
 
 kubectl apply -f examples/example-app
diff --git a/hack/example-service-monitoring/teardown b/hack/example-service-monitoring/teardown
index 62b546de..1a49f462 100755
--- a/hack/example-service-monitoring/teardown
+++ b/hack/example-service-monitoring/teardown
@@ -1,3 +1,9 @@
 #!/usr/bin/env bash
+# exit immediately when a command fails
+set -e
+# only exit with zero if all commands of the pipeline exit successfully
+set -o pipefail
+# error on unset variables
+set -u
 
 kubectl delete -f examples/example-app
-- 
GitLab