k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/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_LABELS:-true}" == "true" ]]; then 54 name="labels" 55 echo "verifying $name" 56 hack/make-rules/verify/labels.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 57 cd "${REPO_ROOT}" 58 fi 59 if [[ "${VERIFY_ESLINT:-true}" == "true" ]]; then 60 name="eslint" 61 echo "verifying $name" 62 hack/make-rules/verify/eslint.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 63 cd "${REPO_ROOT}" 64 fi 65 if [[ "${VERIFY_PYLINT:-true}" == "true" ]]; then 66 name="pylint" 67 echo "verifying $name" 68 hack/make-rules/verify/pylint.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 69 cd "${REPO_ROOT}" 70 fi 71 if [[ "${VERIFY_BOILERPLATE:-true}" == "true" ]]; then 72 name="boilerplate" 73 echo "verifying $name" 74 hack/make-rules/verify/boilerplate.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 75 cd "${REPO_ROOT}" 76 fi 77 if [[ "${VERIFY_YAMLLINT:-true}" == "true" ]]; then 78 name="yamllint" 79 echo "verifying $name" 80 hack/make-rules/verify/yamllint.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 81 cd "${REPO_ROOT}" 82 fi 83 if [[ "${VERIFY_TS_ROLLUP:-true}" == "true" ]]; then 84 name="rollup typescripts" 85 echo "verifying $name" 86 hack/make-rules/verify/ts-rollup.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 87 cd "${REPO_ROOT}" 88 fi 89 if [[ "${VERIFY_GO_DEPS:-true}" == "true" ]]; then 90 name="go deps" 91 echo "verifying $name" 92 hack/make-rules/verify/go-deps.sh || { FAILED+=($name); echo "ERROR: $name failed"; } 93 cd "${REPO_ROOT}" 94 fi 95 96 # exit based on verify scripts 97 if [[ "${#FAILED[@]}" == 0 ]]; then 98 echo "" 99 echo "All verify checks passed, congrats!" 100 else 101 echo "" 102 echo "One or more verify checks failed! See details above. Failed check:" 103 for failed in "${FAILED}"; do 104 echo " FAILED: $failed" 105 done 106 res=1 107 fi 108 exit "${res}"