mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Run the build once during presubmit
This commit is contained in:
parent
a95814b593
commit
efa76b72ae
@ -22,7 +22,6 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendocs cmd/genman cmd/genbashcomp
|
|
||||||
|
|
||||||
gendocs=$(kube::util::find-binary "gendocs")
|
gendocs=$(kube::util::find-binary "gendocs")
|
||||||
genman=$(kube::util::find-binary "genman")
|
genman=$(kube::util::find-binary "genman")
|
||||||
|
@ -22,7 +22,6 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
"${KUBE_ROOT}/hack/build-go.sh" cmd/genconversion
|
|
||||||
|
|
||||||
genconversion=$(kube::util::find-binary "genconversion")
|
genconversion=$(kube::util::find-binary "genconversion")
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
|||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendeepcopy
|
|
||||||
|
|
||||||
genconversion=$(kube::util::find-binary "gendeepcopy")
|
genconversion=$(kube::util::find-binary "gendeepcopy")
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ _tmp="${KUBE_ROOT}/_tmp"
|
|||||||
mkdir -p "${_tmp}"
|
mkdir -p "${_tmp}"
|
||||||
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
|
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
|
||||||
|
|
||||||
"${KUBE_ROOT}/hack/build-go.sh"
|
|
||||||
"${KUBE_ROOT}/hack/update-swagger-spec.sh"
|
"${KUBE_ROOT}/hack/update-swagger-spec.sh"
|
||||||
echo "diffing ${SPECROOT} against freshly generated swagger spec"
|
echo "diffing ${SPECROOT} against freshly generated swagger spec"
|
||||||
ret=0
|
ret=0
|
||||||
|
@ -8,12 +8,22 @@ KUBE_HOOKS_DIR="$(dirname "$(test -L "$0" && echo "$(dirname $0)/$(readlink "$0"
|
|||||||
|
|
||||||
exit_code=0
|
exit_code=0
|
||||||
|
|
||||||
|
echo -ne "Checking that it builds... "
|
||||||
|
if ! OUT=$("hack/build-go.sh" 2>&1); then
|
||||||
|
echo
|
||||||
|
echo "${red}${OUT}"
|
||||||
|
exit_code=1
|
||||||
|
else
|
||||||
|
echo "${green}OK"
|
||||||
|
fi
|
||||||
|
echo "${reset}"
|
||||||
|
|
||||||
echo -ne "Checking for files that need gofmt... "
|
echo -ne "Checking for files that need gofmt... "
|
||||||
files_need_gofmt=()
|
files_need_gofmt=()
|
||||||
files=($(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v -e "third_party" -e "Godeps"))
|
files=($(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v -e "third_party" -e "Godeps"))
|
||||||
for file in "${files[@]}"; do
|
for file in "${files[@]}"; do
|
||||||
# Check for files that fail gofmt.
|
# Check for files that fail gofmt.
|
||||||
diff="$(git show ":${file}" | gofmt -s -d)"
|
diff="$(git show ":${file}" | gofmt -s -d 2>&1)"
|
||||||
if [[ -n "$diff" ]]; then
|
if [[ -n "$diff" ]]; then
|
||||||
files_need_gofmt+=("${file}")
|
files_need_gofmt+=("${file}")
|
||||||
fi
|
fi
|
||||||
@ -135,4 +145,7 @@ else
|
|||||||
fi
|
fi
|
||||||
echo "${reset}"
|
echo "${reset}"
|
||||||
|
|
||||||
exit $exit_code
|
if [[ "${exit_code}" != 0 ]]; then
|
||||||
|
echo "${red}Aborting commit${reset}"
|
||||||
|
fi
|
||||||
|
exit ${exit_code}
|
||||||
|
Loading…
Reference in New Issue
Block a user