github.com/prysmaticlabs/prysm@v1.4.4/scripts/check_gazelle.sh (about) 1 #!/bin/bash 2 3 # Continous Integration script to check that BUILD.bazel files are as expected 4 # when generated from gazelle. 5 6 # Duplicate redirect 5 to stdout so that it can be captured, but still printed 7 # nicely. 8 exec 5>&1 9 10 # Run gazelle while piping a copy of the output to stdout via 5. 11 changes=$(bazel --batch --bazelrc=.buildkite-bazelrc run //:gazelle -- fix --mode=diff | tee >(cat - >&5)) 12 13 # If the captured stdout is not empty then Gazelle has diffs. 14 if [ -z "$changes" ] 15 then 16 echo "OK: Gazelle does not need to be run" 17 exit 0 18 else 19 echo "FAIL: Gazelle needs to be run" 20 echo "Please run bazel run //:gazelle -- fix" 21 exit 1 22 fi