1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 06:45:27 +01:00
Files
prometheus-operator/scripts/check_license.sh
Max Leonard Inden 652300d947 *.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

```
2018-08-16 11:20:38 +02:00

18 lines
459 B
Bash
Executable File

#!/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 \
sh -c 'head -n3 $1 | grep -Eq "(Copyright|generated|GENERATED)" || echo -e $1' {} {} \;
)
if [ -n "${licRes}" ]; then
echo -e "license header checking failed:\\n${licRes}"
exit 255
fi