mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Merge pull request #48842 from enisoc/quick-verify
Automatic merge from submit-queue Add quick-verify make rule. This is useful for humans to run to catch obvious problems before pushing commits and waiting for CI to run verify checks. Quick mode only runs a whitelist of verify scripts that are reasonably fast. I set the initial bar arbitrarily at <10s each on my workstation. The whole set runs in <30s for me, assuming I had already run `make` and `hack/godep-restore.sh`. This is compared to the full `make verify` which takes [I don't know how long because I gave up after 45min].
This commit is contained in:
commit
048b0600f9
@ -126,6 +126,21 @@ verify: verify_generated_files
|
|||||||
KUBE_VERIFY_GIT_BRANCH=$(BRANCH) hack/make-rules/verify.sh -v
|
KUBE_VERIFY_GIT_BRANCH=$(BRANCH) hack/make-rules/verify.sh -v
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
define QUICK_VERIFY_HELP_INFO
|
||||||
|
# Runs only the presubmission verifications that aren't slow.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# make quick-verify
|
||||||
|
endef
|
||||||
|
.PHONY: quick-verify
|
||||||
|
ifeq ($(PRINT_HELP),y)
|
||||||
|
quick-verify:
|
||||||
|
@echo "$$QUICK_VERIFY_HELP_INFO"
|
||||||
|
else
|
||||||
|
quick-verify: verify_generated_files
|
||||||
|
hack/make-rules/verify.sh -v -Q
|
||||||
|
endif
|
||||||
|
|
||||||
define UPDATE_HELP_INFO
|
define UPDATE_HELP_INFO
|
||||||
# Runs all the generated updates.
|
# Runs all the generated updates.
|
||||||
#
|
#
|
||||||
|
@ -29,7 +29,25 @@ EXCLUDED_PATTERNS=(
|
|||||||
"verify-*-dockerized.sh" # Don't run any scripts that intended to be run dockerized
|
"verify-*-dockerized.sh" # Don't run any scripts that intended to be run dockerized
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Only run whitelisted fast checks in quick mode.
|
||||||
|
# These run in <10s each on enisoc's workstation, assuming that
|
||||||
|
# `make` and `hack/godep-restore.sh` had already been run.
|
||||||
|
QUICK_PATTERNS+=(
|
||||||
|
"verify-api-groups.sh"
|
||||||
|
"verify-bazel.sh"
|
||||||
|
"verify-boilerplate.sh"
|
||||||
|
"verify-godep-licenses.sh"
|
||||||
|
"verify-gofmt.sh"
|
||||||
|
"verify-pkg-names.sh"
|
||||||
|
"verify-readonly-packages.sh"
|
||||||
|
"verify-staging-client-go.sh"
|
||||||
|
"verify-staging-imports.sh"
|
||||||
|
"verify-test-images.sh"
|
||||||
|
"verify-test-owners.sh"
|
||||||
|
)
|
||||||
|
|
||||||
EXCLUDED_CHECKS=$(ls ${EXCLUDED_PATTERNS[@]/#/${KUBE_ROOT}\/hack\/} 2>/dev/null || true)
|
EXCLUDED_CHECKS=$(ls ${EXCLUDED_PATTERNS[@]/#/${KUBE_ROOT}\/hack\/} 2>/dev/null || true)
|
||||||
|
QUICK_CHECKS=$(ls ${QUICK_PATTERNS[@]/#/${KUBE_ROOT}\/hack\/} 2>/dev/null || true)
|
||||||
|
|
||||||
function is-excluded {
|
function is-excluded {
|
||||||
for e in ${EXCLUDED_CHECKS[@]}; do
|
for e in ${EXCLUDED_CHECKS[@]}; do
|
||||||
@ -40,6 +58,15 @@ function is-excluded {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is-quick {
|
||||||
|
for e in ${QUICK_CHECKS[@]}; do
|
||||||
|
if [[ $1 -ef "$e" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function run-cmd {
|
function run-cmd {
|
||||||
if ${SILENT}; then
|
if ${SILENT}; then
|
||||||
"$@" &> /dev/null
|
"$@" &> /dev/null
|
||||||
@ -58,6 +85,10 @@ function run-checks {
|
|||||||
echo "Skipping ${t}"
|
echo "Skipping ${t}"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
if ${QUICK} && ! is-quick "${t}" ; then
|
||||||
|
echo "Skipping ${t} in quick mode"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
echo -e "Verifying ${t}"
|
echo -e "Verifying ${t}"
|
||||||
local start=$(date +%s)
|
local start=$(date +%s)
|
||||||
run-cmd "${runner}" "${t}" && tr=$? || tr=$?
|
run-cmd "${runner}" "${t}" && tr=$? || tr=$?
|
||||||
@ -71,11 +102,17 @@ function run-checks {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":v" opt; do
|
SILENT=true
|
||||||
|
QUICK=false
|
||||||
|
|
||||||
|
while getopts ":vQ" opt; do
|
||||||
case ${opt} in
|
case ${opt} in
|
||||||
v)
|
v)
|
||||||
SILENT=false
|
SILENT=false
|
||||||
;;
|
;;
|
||||||
|
Q)
|
||||||
|
QUICK=true
|
||||||
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid flag: -${OPTARG}" >&2
|
echo "Invalid flag: -${OPTARG}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -87,6 +124,10 @@ if ${SILENT} ; then
|
|||||||
echo "Running in silent mode, run with -v if you want to see script logs."
|
echo "Running in silent mode, run with -v if you want to see script logs."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ${QUICK} ; then
|
||||||
|
echo "Running in quick mode (-Q flag). Only fast checks will run."
|
||||||
|
fi
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
|
run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
|
||||||
run-checks "${KUBE_ROOT}/hack/verify-*.py" python
|
run-checks "${KUBE_ROOT}/hack/verify-*.py" python
|
||||||
|
Loading…
Reference in New Issue
Block a user