1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

*.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

```
This commit is contained in:
Max Leonard Inden 2018-08-16 11:07:36 +02:00
parent 2595c90b97
commit 652300d947
No known key found for this signature in database
GPG key ID: 5403C5464810BC26
11 changed files with 68 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
# Concatenate all files with "---" because that's how to specify multiple
# Kubernetes manifests in one file. Because the first `awk` also adds "---" in

View file

@ -1,4 +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
hack/concat-kubernetes-manifests.sh example/rbac/prometheus-operator/*.yaml > bundle.yaml

View file

@ -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
jsonnet -J hack/generate/vendor hack/generate/prometheus-operator-non-rbac.jsonnet | gojsontoyaml > example/non-rbac/prometheus-operator.yaml

View file

@ -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
rm -rf tmp
mkdir tmp

View file

@ -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
if [[ -z "$1" ]]; then
echo "missing cluster name"

View file

@ -1,3 +1,9 @@
#!/bin/bash
#!/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 get pods --all-namespaces -l app="${1}" -ojsonpath="{.items[*].spec.containers[?(@.name==\"$1\")].image}"

View file

@ -1,3 +1,9 @@
#!/bin/bash
#!/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 -n prometheus-operator-e2e-tests exec -it prometheus-test-0 -c prometheus '/bin/sh -c "cat /etc/prometheus/rules/rules-0/test.rules"'

View file

@ -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
licRes=$(
find . -type f -iname '*.go' ! -path '*/vendor/*' -exec \