sigs.k8s.io/cluster-api/bootstrap/kubeadm@v0.0.0-20191016155141-23a891785b60/hack/verify-all.sh (about) 1 #!/usr/bin/env bash 2 # Copyright 2019 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 pipefail 18 19 # shellcheck source=/dev/null 20 source "$(dirname "$0")/utils.sh" 21 22 # set REPO_PATH 23 REPO_PATH=$(get_root_path) 24 cd "${REPO_PATH}" 25 26 failure() { 27 if [[ "${1}" != 0 ]]; then 28 res=1 29 failed+=("${2}") 30 outputs+=("${3}") 31 fi 32 } 33 34 # exit code, if a script fails we'll set this to 1 35 res=0 36 failed=() 37 outputs=() 38 39 # run all verify scripts, optionally skipping any of them 40 41 if [[ "${VERIFY_MANIFESTS:-true}" == "true" ]]; then 42 echo "[*] Verifying manifests..." 43 out=$(hack/verify-manifests.sh 2>&1) 44 failure $? "verify-manifests.sh" "${out}" 45 cd "${REPO_PATH}" 46 fi 47 48 if [[ "${VERIFY_BOILERPLATE:-true}" == "true" ]]; then 49 echo "[*] Verifying boilerplate..." 50 out=$(hack/verify-boilerplate.sh 2>&1) 51 failure $? "verify-boilerplate.sh" "${out}" 52 cd "${REPO_PATH}" 53 fi 54 55 if [[ "${VERIFY_DEPS:-true}" == "true" ]]; then 56 echo "[*] Verifying deps..." 57 out=$(hack/verify-deps.sh 2>&1) 58 failure $? "verify-deps.sh" "${out}" 59 cd "${REPO_PATH}" 60 fi 61 62 if [[ "${VERIFY_GOLANGCI_LINT:-true}" == "true" ]]; then 63 echo "[*] Verifying golangci-lint..." 64 out=$(hack/verify-golangci-lint.sh 2>&1) 65 failure $? "hack/verify-golangci-lint.sh " "${out}" 66 cd "${REPO_PATH}" 67 fi 68 69 if [[ "${VERIFY_GOTEST:-true}" == "true" ]]; then 70 echo "[*] Verifying gotest..." 71 out=$(hack/verify-gotest.sh 2>&1) 72 failure $? "verify-gotest.sh" "${out}" 73 cd "${REPO_PATH}" 74 fi 75 76 if [[ "${VERIFY_BUILD:-true}" == "true" ]]; then 77 echo "[*] Verifying build..." 78 out=$(hack/verify-build.sh 2>&1) 79 failure $? "verify-build.sh" "${out}" 80 cd "${REPO_PATH}" 81 fi 82 83 if [[ "${VERIFY_DOCKER_BUILD:-true}" == "true" ]]; then 84 echo "[*] Verifying docker build..." 85 out=$(hack/verify-docker-build.sh 2>&1) 86 failure $? "verify-docker-build.sh" "${out}" 87 cd "${REPO_PATH}" 88 fi 89 90 # exit based on verify scripts 91 if [[ "${res}" = 0 ]]; then 92 echo "" 93 echo "All verify checks passed, congrats!" 94 else 95 echo "" 96 echo "Some of the verify scripts failed:" 97 for i in "${!failed[@]}"; do 98 echo "- ${failed[$i]}:" 99 echo "${outputs[$i]}" 100 echo 101 done 102 fi 103 exit "${res}"