sigs.k8s.io/prow@v0.0.0-20240503223140-c5e374dc7eb1/hack/make-rules/verify/all.sh (about) 1 #!/usr/bin/env bash 2 # Copyright 2021 The Kubernetes Authors. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 set -o nounset 17 set -o errexit 18 set -o pipefail 19 20 REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd -P)" 21 cd $REPO_ROOT 22 23 # exit code, if a script fails we'll set this to 1 24 res=0 25 26 # run all verify scripts, optionally skipping any of them 27 28 FAILED=() 29 if [[ "${VERIFY_GO_LINT:-true}" == "true" ]]; then 30 name="go lints" 31 echo "verifying $name ..." 32 hack/make-rules/verify/golangci-lint.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 33 cd "${REPO_ROOT}" 34 fi 35 if [[ "${VERIFY_GOFMT:-true}" == "true" ]]; then 36 name="go fmt" 37 echo "verifying $name" 38 hack/make-rules/verify/gofmt.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 39 cd "${REPO_ROOT}" 40 fi 41 if [[ "${VERIFY_FILE_PERMS:-true}" == "true" ]]; then 42 name=".sh files permissions" 43 echo "verifying $name" 44 hack/make-rules/verify/file-perms.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 45 cd "${REPO_ROOT}" 46 fi 47 if [[ "${VERIFY_SPELLING:-true}" == "true" ]]; then 48 name="spelling" 49 echo "verifying $name" 50 hack/make-rules/verify/misspell.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 51 cd "${REPO_ROOT}" 52 fi 53 if [[ "${VERIFY_CODEGEN:-true}" == "true" ]]; then 54 name="codegen" 55 echo "verifying $name" 56 hack/make-rules/verify/codegen.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 57 cd "${REPO_ROOT}" 58 fi 59 if [[ "${VERIFY_BOILERPLATE:-true}" == "true" ]]; then 60 name="boilerplate" 61 echo "verifying $name" 62 hack/make-rules/verify/boilerplate.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 63 cd "${REPO_ROOT}" 64 fi 65 if [[ "${VERIFY_GO_DEPS:-true}" == "true" ]]; then 66 name="go deps" 67 echo "verifying $name" 68 hack/make-rules/verify/go-deps.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 69 cd "${REPO_ROOT}" 70 fi 71 72 # exit based on verify scripts 73 if [[ "${#FAILED[@]}" == 0 ]]; then 74 echo "" 75 echo "All verify checks passed, congrats!" 76 else 77 echo "" 78 echo "One or more verify checks failed! See details above. Failed check:" 79 for failed in "${FAILED}"; do 80 echo " FAILED: $failed" 81 done 82 res=1 83 fi 84 exit "${res}"