Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use common function cd_root_path to cd to the root path #2266

Merged
merged 1 commit into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 13 additions & 14 deletions kinder/hack/verify-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ set -o pipefail
# shellcheck source=/dev/null
source "$(dirname "$0")/utils.sh"

# set REPO_PATH
REPO_PATH=$(get_root_path)
cd "${REPO_PATH}"
# cd to the root path
cd_root_path

# exit code, if a script fails we'll set this to 1
res=0
Expand All @@ -35,67 +34,67 @@ res=0
if [[ "${VERIFY_WHITESPACE:-true}" == "true" ]]; then
echo "[*] Verifying whitespace..."
hack/verify-whitespace.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_SPELLING:-true}" == "true" ]]; then
echo "[*] Verifying spelling..."
hack/verify-spelling.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_BOILERPLATE:-true}" == "true" ]]; then
echo "[*] Verifying boilerplate..."
hack/verify-boilerplate.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_GOFMT:-true}" == "true" ]]; then
echo "[*] Verifying gofmt..."
hack/verify-gofmt.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_GOLINT:-true}" == "true" ]]; then
echo "[*] Verifying golint..."
hack/verify-golint.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_GOVET:-true}" == "true" ]]; then
echo "[*] Verifying govet..."
hack/verify-govet.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_WORKFLOWS:-true}" == "true" ]]; then
echo "[*] Verifying workflows..."
hack/verify-workflows.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_DEPS:-true}" == "true" ]]; then
echo "[*] Verifying deps..."
hack/verify-deps.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_STATICCHECK:-true}" == "true" ]]; then
echo "[*] Verifying staticcheck..."
hack/verify-staticcheck.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_GOTEST:-true}" == "true" ]]; then
echo "[*] Verifying gotest..."
hack/verify-gotest.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

if [[ "${VERIFY_BUILD:-true}" == "true" ]]; then
echo "[*] Verifying build..."
hack/verify-build.sh || res=1
cd "${REPO_PATH}"
cd_root_path
fi

# exit based on verify scripts
Expand Down
27 changes: 13 additions & 14 deletions operator/hack/verify-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ set -o pipefail
# shellcheck source=/dev/null
source "$(dirname "$0")/utils.sh"

# set REPO_PATH
readonly REPO_PATH=$(get_root_path)
cd "${REPO_PATH}" || exit
# cd to the root path
cd_root_path

failure() {
if [[ "${1}" != 0 ]]; then
Expand All @@ -42,77 +41,77 @@ if [[ "${VERIFY_WHITESPACE:-true}" == "true" ]]; then
echo "[*] Verifying whitespace..."
out=$(hack/verify-whitespace.sh 2>&1)
failure $? "verify-whitespace.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_SPELLING:-true}" == "true" ]]; then
echo "[*] Verifying spelling..."
out=$(hack/verify-spelling.sh 2>&1)
failure $? "verify-spelling.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_BOILERPLATE:-true}" == "true" ]]; then
echo "[*] Verifying boilerplate..."
out=$(hack/verify-boilerplate.sh 2>&1)
failure $? "verify-boilerplate.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_GOFMT:-true}" == "true" ]]; then
echo "[*] Verifying gofmt..."
out=$(hack/verify-gofmt.sh 2>&1)
failure $? "verify-gofmt.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_GOIMPORTS:-true}" == "true" ]]; then
echo "[*] Verifying goimports..."
out=$(hack/verify-goimports.sh 2>&1)
failure $? "verify-goimports.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_GOLINT:-true}" == "true" ]]; then
echo "[*] Verifying golint..."
out=$(hack/verify-golint.sh 2>&1)
failure $? "verify-golint.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_GOVET:-true}" == "true" ]]; then
echo "[*] Verifying govet..."
out=$(hack/verify-govet.sh 2>&1)
failure $? "verify-govet.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_DEPS:-true}" == "true" ]]; then
echo "[*] Verifying deps..."
out=$(hack/verify-deps.sh 2>&1)
failure $? "verify-deps.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_GOTEST:-true}" == "true" ]]; then
echo "[*] Verifying gotest..."
out=$(hack/verify-gotest.sh 2>&1)
failure $? "verify-gotest.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_BUILD:-true}" == "true" ]]; then
echo "[*] Verifying build..."
out=$(hack/verify-build.sh 2>&1)
failure $? "verify-build.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

if [[ "${VERIFY_DOCKER_BUILD:-true}" == "true" ]]; then
echo "[*] Verifying manager docker image build..."
out=$(hack/verify-docker-build.sh 2>&1)
failure $? "verify-docker-build.sh" "${out}"
cd "${REPO_PATH}" || exit
cd_root_path
fi

# exit based on verify scripts
Expand Down