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:
parent
2595c90b97
commit
652300d947
11 changed files with 68 additions and 3 deletions
contrib/kube-prometheus
hack
scripts
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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"'
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue