Get rid of hack/after-build scripts

The build is now fast enough to not need them.
pull/6/head
Tim Hockin 2016-05-03 22:00:27 -07:00
parent 833770d9ac
commit 18e7a3eb24
29 changed files with 434 additions and 760 deletions

View File

@ -89,7 +89,8 @@ gen-conversion script.
3. Generate protobuf objects:
1. Add your group to `cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go` to `New()` in the `Packages` field
1. Add your group to `cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go` to
`New()` in the `Packages` field
2. Run hack/update-generated-protobuf.sh
### Client (optional):

View File

@ -1,4 +0,0 @@
These should be called only by a script (or a user) who knows that the binaries are built and correct. Normal users should just have the versions in ../ which should just always do a build.
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/hack/after-build/README.md?pixel)]()

View File

@ -1,42 +0,0 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
clientgen=$(kube::util::find-binary "client-gen")
conversiongen=$(kube::util::find-binary "conversion-gen")
deepcopygen=$(kube::util::find-binary "deepcopy-gen")
setgen=$(kube::util::find-binary "set-gen")
# Please do not add any logic to this shell script. Add logic to the go code
# that generates the set-gen program.
#
# This can be called with one flag, --verify-only, so it works for both the
# update- and verify- scripts.
${clientgen} "$@"
${clientgen} -t "$@"
${conversiongen} "$@"
${deepcopygen} "$@"
${setgen} "$@"
# You may add additional calls of code generators like set-gen above.

View File

@ -1,26 +0,0 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
$(kube::util::find-binary "import-boss") "$@"

View File

@ -1,73 +0,0 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
kube::util::ensure-temp-dir
kube::util::gen-docs "${KUBE_TEMP}"
# remove all of the old docs
while read file; do
rm "${KUBE_ROOT}/${file}" 2>/dev/null || true
done <"${KUBE_ROOT}/.generated_docs"
# the shopt is so that we get .generated_docs from the glob.
shopt -s dotglob
cp -af "${KUBE_TEMP}"/* "${KUBE_ROOT}"
shopt -u dotglob
kube::util::gen-analytics "${KUBE_ROOT}"
mungedocs=$(kube::util::find-binary "mungedocs")
"${mungedocs}" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${KUBE_ROOT}/docs/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/docs/ requires manual changes. See preceding errors."
exit 1
elif [[ $ret -gt 1 ]]; then
echo "Error running mungedocs."
exit 1
fi
"${mungedocs}" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${KUBE_ROOT}/examples/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/examples/ requires manual changes. See preceding errors."
exit 1
elif [[ $ret -gt 1 ]]; then
echo "Error running mungedocs."
exit 1
fi
"${mungedocs}" "--upstream=${KUBE_GIT_UPSTREAM}" \
"--skip-munges=unversioned-warning,analytics" \
"--norecurse" \
"--root-dir=${KUBE_ROOT}/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/ requires manual changes. See preceding errors."
exit 1
elif [[ $ret -gt 1 ]]; then
echo "Error running mungedocs."
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -1,101 +0,0 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Script to fetch latest swagger spec.
# Puts the updated spec at swagger-spec/
set -o errexit
set -o nounset
set -o pipefail
echo "Note: This assumes that types_swagger_doc_generated.go has been updated for all API group versions. Please run hack/update-generated-swagger-docs.sh to ensure that."
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
SWAGGER_ROOT_DIR="${KUBE_ROOT}/api/swagger-spec"
source "${KUBE_ROOT}/hack/lib/init.sh"
function cleanup()
{
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
kube::etcd::cleanup
kube::log::status "Clean up complete"
}
trap cleanup EXIT SIGINT
kube::golang::setup_env
apiserver=$(kube::util::find-binary "kube-apiserver")
TMP_DIR=$(mktemp -d /tmp/update-swagger-spec.XXXX)
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-4001}
API_PORT=${API_PORT:-8050}
API_HOST=${API_HOST:-127.0.0.1}
KUBELET_PORT=${KUBELET_PORT:-10250}
kube::etcd::start
# Start kube-apiserver
kube::log::status "Starting kube-apiserver"
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
--insecure-bind-address="127.0.0.1" \
--bind-address="127.0.0.1" \
--insecure-port="${API_PORT}" \
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
--advertise-address="10.10.10.10" \
--cert-dir="${TMP_DIR}/certs" \
--service-cluster-ip-range="10.0.0.0/24" >/tmp/swagger-api-server.log 2>&1 &
APISERVER_PID=$!
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/healthz" "apiserver: "
SWAGGER_API_PATH="http://127.0.0.1:${API_PORT}/swaggerapi/"
DEFAULT_GROUP_VERSIONS="v1 autoscaling/v1 batch/v1 extensions/v1beta1 apps/v1alpha1"
VERSIONS=${VERSIONS:-$DEFAULT_GROUP_VERSIONS}
kube::log::status "Updating " ${SWAGGER_ROOT_DIR}
for ver in ${VERSIONS}; do
# fetch the swagger spec for each group version.
if [[ ${ver} == "v1" ]]; then
SUBPATH="api"
else
SUBPATH="apis"
fi
SUBPATH="${SUBPATH}/${ver}"
SWAGGER_JSON_NAME="$(kube::util::gv-to-swagger-name ${ver}).json"
curl -w "\n" -fs "${SWAGGER_API_PATH}${SUBPATH}" > "${SWAGGER_ROOT_DIR}/${SWAGGER_JSON_NAME}"
# fetch the swagger spec for the discovery mechanism at group level.
if [[ ${ver} == "v1" ]]; then
continue
fi
SUBPATH="apis/"${ver%/*}
SWAGGER_JSON_NAME="${ver%/*}.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}${SUBPATH}" > "${SWAGGER_ROOT_DIR}/${SWAGGER_JSON_NAME}"
done
# fetch swagger specs for other discovery mechanism.
curl -w "\n" -fs "${SWAGGER_API_PATH}" > "${SWAGGER_ROOT_DIR}/resourceListing.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}version" > "${SWAGGER_ROOT_DIR}/version.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}api" > "${SWAGGER_ROOT_DIR}/api.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}apis" > "${SWAGGER_ROOT_DIR}/apis.json"
kube::log::status "SUCCESS"
# ex: ts=2 sw=2 et filetype=sh

View File

@ -1,86 +0,0 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
# Find binary
genswaggertypedocs=$(kube::util::find-binary "genswaggertypedocs")
gen_swagger_result=0
result=0
find_files() {
find . -not \( \
\( \
-wholename './output' \
-o -wholename './_output' \
-o -wholename './_gopath' \
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/vendor/*' \
\) -prune \
\) \
\( -wholename '*pkg/api/v*/types.go' \
-o -wholename '*pkg/apis/*/v*/types.go' \
-o -wholename '*pkg/api/unversioned/types.go' \
\)
}
if [[ $# -eq 0 ]]; then
versioned_api_files=$(find_files | egrep "pkg/.[^/]*/((v.[^/]*)|unversioned)/types\.go")
else
versioned_api_files="${*}"
fi
for file in $versioned_api_files; do
$genswaggertypedocs -v -s "${file}" -f - || gen_swagger_result=$?
if [[ "${gen_swagger_result}" -ne "0" ]]; then
echo "API file: ${file} is missing: ${gen_swagger_result} descriptions"
result=1
fi
if grep json: "${file}" | grep -v // | grep description: ; then
echo "API file: ${file} should not contain descriptions in struct tags"
result=1
fi
if grep json: "${file}" | grep -Ee ",[[:space:]]+omitempty|omitempty[[:space:]]+" ; then
echo "API file: ${file} should not contain leading or trailing spaces for omitempty directive"
result=1
fi
done
internal_types_files="${KUBE_ROOT}/pkg/api/types.go ${KUBE_ROOT}/pkg/apis/extensions/types.go"
for internal_types_file in $internal_types_files; do
if [[ ! -e $internal_types_file ]]; then
echo "Internal types file ${internal_types_file} does not exist"
result=1
continue
fi
if grep json: "${internal_types_file}" | grep -v // | grep description: ; then
echo "Internal API types should not contain descriptions"
result=1
fi
done
exit ${result}

View File

@ -1,35 +0,0 @@
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Verify that E2E's use Describe wrappers, so that we can auto tag and provide
# other wrapper functionality for the entire suite.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
cd "${KUBE_ROOT}"
findDescViolations() {
find ./test/e2e/ -name '*.go' | xargs cat | grep "\sDescribe("
}
# There should be only one call to describe.
if [ $(findDescViolations | wc -l) != 1 ]; then
echo "The following lines use Describe instead of KubeDescribe."
echo "Describe() is a reserved term which only should called via the KubeDescribe wrapper function."
findDescViolations
fi

View File

@ -1,82 +0,0 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
# Find binary
gendocs=$(kube::util::find-binary "gendocs")
genkubedocs=$(kube::util::find-binary "genkubedocs")
genman=$(kube::util::find-binary "genman")
genyaml=$(kube::util::find-binary "genyaml")
genbashcomp=$(kube::util::find-binary "genbashcomp")
mungedocs=$(kube::util::find-binary "mungedocs")
DOCROOT="${KUBE_ROOT}/docs/"
EXAMPLEROOT="${KUBE_ROOT}/examples/"
# mungedocs --verify can (and should) be run on the real docs, otherwise their
# links will be distorted. --verify means that it will not make changes.
# --verbose gives us output we can use for a diff.
"${mungedocs}" "--verify=true" "--verbose=true" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${DOCROOT}" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${DOCROOT} is out of date. Please run hack/update-generated-docs.sh"
exit 1
fi
if [[ $ret -gt 1 ]]; then
echo "Error running mungedocs"
exit 1
fi
"${mungedocs}" "--verify=true" "--verbose=true" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${EXAMPLEROOT}" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${EXAMPLEROOT} is out of date. Please run hack/update-generated-docs.sh"
exit 1
fi
if [[ $ret -gt 1 ]]; then
echo "Error running mungedocs"
exit 1
fi
kube::util::ensure-temp-dir
kube::util::gen-docs "${KUBE_TEMP}"
diff -Naup "${KUBE_TEMP}/.generated_docs" "${KUBE_ROOT}/.generated_docs" || ret=1 || true
while read file; do
diff -Naup "${KUBE_TEMP}/${file}" "${KUBE_ROOT}/${file}" || ret=1 || true
done <"${KUBE_TEMP}/.generated_docs"
needsanalytics=($(kube::util::gen-analytics "${KUBE_ROOT}" 1))
if [[ ${#needsanalytics[@]} -ne 0 ]]; then
echo -e "Some md files are missing ga-beacon analytics link:"
printf '%s\n' "${needsanalytics[@]}"
ret=1
fi
if [[ $ret -eq 0 ]]
then
echo "Generated docs are up to date."
else
echo "Generated docs are out of date. Please run hack/update-generated-docs.sh"
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -1,59 +0,0 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
APIROOTS=${APIROOTS:-pkg/api pkg/apis pkg/runtime pkg/util/intstr pkg/watch}
_tmp="${KUBE_ROOT}/_tmp"
cleanup() {
rm -rf "${_tmp}"
}
trap "cleanup" EXIT SIGINT
cleanup
for APIROOT in ${APIROOTS}; do
mkdir -p "${_tmp}/${APIROOT%/*}"
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
done
# If not running as root, we need to use sudo to restore the original generated
# protobuf files.
SUDO=""
if [[ "$(id -u)" != '0' ]]; then
SUDO="sudo"
fi
"${KUBE_ROOT}/hack/update-generated-protobuf.sh"
for APIROOT in ${APIROOTS}; do
TMP_APIROOT="${_tmp}/${APIROOT}"
echo "diffing ${APIROOT} against freshly generated protobuf"
ret=0
diff -Naupr -I 'Auto generated by' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
${SUDO} cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/${APIROOT%/*}"
if [[ $ret -eq 0 ]]; then
echo "${APIROOT} up to date."
else
echo "${APIROOT} is out of date. Please run hack/update-generated-protobuf.sh"
exit 1
fi
done

View File

@ -1,58 +0,0 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
# Find binary
genswaggertypedocs=$(kube::util::find-binary "genswaggertypedocs")
if [[ ! -x "$genswaggertypedocs" ]]; then
{
echo "It looks as if you don't have a compiled genswaggertypedocs binary"
echo
echo "If you are running from a clone of the git repo, please run"
echo "'./hack/build-go.sh cmd/genswaggertypedocs'."
} >&2
exit 1
fi
DIFFROOT="${KUBE_ROOT}/pkg"
TMP_DIFFROOT="${KUBE_ROOT}/_tmp/pkg"
_tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${DIFFROOT}" "${TMP_DIFFROOT}"
"${KUBE_ROOT}/hack/update-generated-swagger-docs.sh"
echo "diffing ${DIFFROOT} against freshly generated swagger type documentation"
ret=0
diff -Naupr -I 'Auto generated by' "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
cp -a "${TMP_DIFFROOT}" "${KUBE_ROOT}/"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
echo "${DIFFROOT} up to date."
else
echo "${DIFFROOT} is out of date. Please run hack/update-generated-swagger-docs.sh"
exit 1
fi

View File

@ -1,58 +0,0 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
linkcheck=$(kube::util::find-binary "linkcheck")
kube::util::ensure-temp-dir
OUTPUT="${KUBE_TEMP}"/linkcheck-output
cleanup() {
rm -rf "${OUTPUT}"
}
trap "cleanup" EXIT SIGINT
mkdir -p "$OUTPUT"
APIROOT="${KUBE_ROOT}/pkg/api/"
APISROOT="${KUBE_ROOT}/pkg/apis/"
DOCROOT="${KUBE_ROOT}/docs/"
ROOTS=($APIROOT $APISROOT $DOCROOT)
found_invalid=false
for root in "${ROOTS[@]}"; do
"${linkcheck}" "--root-dir=${root}" 2> >(tee -a "${OUTPUT}/error" >&2) && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "Failed: found invalid links in ${root}."
found_invalid=true
fi
if [[ $ret -gt 1 ]]; then
echo "Error running linkcheck"
exit 1
fi
done
if [ ${found_invalid} = true ]; then
echo "Summary of invalid links:"
cat ${OUTPUT}/error
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -1,49 +0,0 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
apiserver=$(kube::util::find-binary "kube-apiserver")
SPECROOT="${KUBE_ROOT}/api/swagger-spec"
TMP_SPECROOT="${KUBE_ROOT}/_tmp/swagger-spec"
_tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
"${KUBE_ROOT}/hack/update-swagger-spec.sh"
echo "diffing ${SPECROOT} against freshly generated swagger spec"
ret=0
diff -Naupr -I 'Auto generated by' "${SPECROOT}" "${TMP_SPECROOT}" || ret=$?
cp -a ${TMP_SPECROOT} "${KUBE_ROOT}/api"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
echo "${SPECROOT} up to date."
else
echo "${SPECROOT} is out of date. Please run hack/update-swagger-spec.sh"
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -1,47 +0,0 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
# add other BADSYMBOLS here.
BADSYMBOLS=(
"httptest"
"testify"
"testing[.]"
)
# b/c hyperkube binds everything simply check that for bad symbols
SYMBOLS="$(nm ${KUBE_OUTPUT_HOSTBIN}/hyperkube)"
RESULT=0
for BADSYMBOL in "${BADSYMBOLS[@]}"; do
if FOUND=$(echo "$SYMBOLS" | grep "$BADSYMBOL"); then
echo "Found bad symbol '${BADSYMBOL}':"
echo "$FOUND"
RESULT=1
fi
done
exit $RESULT
# ex: ts=2 sw=2 et filetype=sh

View File

@ -23,9 +23,28 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/client-gen
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/conversion-gen
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/deepcopy-gen
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/set-gen
BUILD_TARGETS=(
cmd/libs/go2idl/client-gen
cmd/libs/go2idl/conversion-gen
cmd/libs/go2idl/deepcopy-gen
cmd/libs/go2idl/set-gen
)
"${KUBE_ROOT}/hack/build-go.sh" ${BUILD_TARGETS[*]}
"${KUBE_ROOT}/hack/after-build/run-codegen.sh" "$@"
clientgen=$(kube::util::find-binary "client-gen")
conversiongen=$(kube::util::find-binary "conversion-gen")
deepcopygen=$(kube::util::find-binary "deepcopy-gen")
setgen=$(kube::util::find-binary "set-gen")
# Please do not add any logic to this shell script. Add logic to the go code
# that generates the set-gen program.
#
# This can be called with one flag, --verify-only, so it works for both the
# update- and verify- scripts.
${clientgen} "$@"
${clientgen} -t "$@"
${conversiongen} "$@"
${deepcopygen} "$@"
${setgen} "$@"
# You may add additional calls of code generators like set-gen above.

View File

@ -23,8 +23,59 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendocs cmd/genkubedocs cmd/genman cmd/genyaml cmd/genbashcomp cmd/mungedocs
"${KUBE_ROOT}/hack/build-go.sh" \
cmd/gendocs \
cmd/genkubedocs \
cmd/genman \
cmd/genyaml \
cmd/genbashcomp \
cmd/mungedocs
"${KUBE_ROOT}/hack/after-build/update-generated-docs.sh" "$@"
kube::util::ensure-temp-dir
kube::util::gen-docs "${KUBE_TEMP}"
# remove all of the old docs
while read file; do
rm "${KUBE_ROOT}/${file}" 2>/dev/null || true
done <"${KUBE_ROOT}/.generated_docs"
# the shopt is so that we get .generated_docs from the glob.
shopt -s dotglob
cp -af "${KUBE_TEMP}"/* "${KUBE_ROOT}"
shopt -u dotglob
kube::util::gen-analytics "${KUBE_ROOT}"
mungedocs=$(kube::util::find-binary "mungedocs")
"${mungedocs}" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${KUBE_ROOT}/docs/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/docs/ requires manual changes. See preceding errors."
exit 1
elif [[ $ret -gt 1 ]]; then
echo "Error running mungedocs."
exit 1
fi
"${mungedocs}" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${KUBE_ROOT}/examples/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/examples/ requires manual changes. See preceding errors."
exit 1
elif [[ $ret -gt 1 ]]; then
echo "Error running mungedocs."
exit 1
fi
"${mungedocs}" "--upstream=${KUBE_GIT_UPSTREAM}" \
"--skip-munges=unversioned-warning,analytics" \
"--norecurse" \
"--root-dir=${KUBE_ROOT}/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/ requires manual changes. See preceding errors."
exit 1
elif [[ $ret -gt 1 ]]; then
echo "Error running mungedocs."
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env

View File

@ -49,6 +49,6 @@ mkdir -p "${LOCAL_OUTPUT_BUILD_CONTEXT}"
cp "${KUBE_ROOT}/cmd/libs/go2idl/go-to-protobuf/build-image/Dockerfile" "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
kube::build::update_dockerfile
kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${LOCAL_OUTPUT_BUILD_CONTEXT}" 'false'
kube::build::run_build_command hack/after-build/update-generated-protobuf.sh "$@"
kube::build::run_build_command hack/update-generated-protobuf-dockerized.sh "$@"
# ex: ts=2 sw=2 et filetype=sh

View File

@ -21,13 +21,89 @@ set -o errexit
set -o nounset
set -o pipefail
cat << __EOF__
Note: This assumes that the 'types_swagger_doc_generated.go' file has been
updated for all API group versions. If you are unsure, please run
hack/update-generated-swagger-docs.sh first.
__EOF__
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
SWAGGER_ROOT_DIR="${KUBE_ROOT}/api/swagger-spec"
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/kube-apiserver
"${KUBE_ROOT}/hack/after-build/update-swagger-spec.sh" "$@"
function cleanup()
{
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
kube::etcd::cleanup
kube::log::status "Clean up complete"
}
trap cleanup EXIT SIGINT
kube::golang::setup_env
apiserver=$(kube::util::find-binary "kube-apiserver")
TMP_DIR=$(mktemp -d /tmp/update-swagger-spec.XXXX)
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-4001}
API_PORT=${API_PORT:-8050}
API_HOST=${API_HOST:-127.0.0.1}
KUBELET_PORT=${KUBELET_PORT:-10250}
kube::etcd::start
# Start kube-apiserver
kube::log::status "Starting kube-apiserver"
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
--insecure-bind-address="127.0.0.1" \
--bind-address="127.0.0.1" \
--insecure-port="${API_PORT}" \
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
--advertise-address="10.10.10.10" \
--cert-dir="${TMP_DIR}/certs" \
--service-cluster-ip-range="10.0.0.0/24" >/tmp/swagger-api-server.log 2>&1 &
APISERVER_PID=$!
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/healthz" "apiserver: "
SWAGGER_API_PATH="http://127.0.0.1:${API_PORT}/swaggerapi/"
DEFAULT_GROUP_VERSIONS="v1 autoscaling/v1 batch/v1 extensions/v1beta1 apps/v1alpha1"
VERSIONS=${VERSIONS:-$DEFAULT_GROUP_VERSIONS}
kube::log::status "Updating " ${SWAGGER_ROOT_DIR}
for ver in ${VERSIONS}; do
# fetch the swagger spec for each group version.
if [[ ${ver} == "v1" ]]; then
SUBPATH="api"
else
SUBPATH="apis"
fi
SUBPATH="${SUBPATH}/${ver}"
SWAGGER_JSON_NAME="$(kube::util::gv-to-swagger-name ${ver}).json"
curl -w "\n" -fs "${SWAGGER_API_PATH}${SUBPATH}" > "${SWAGGER_ROOT_DIR}/${SWAGGER_JSON_NAME}"
# fetch the swagger spec for the discovery mechanism at group level.
if [[ ${ver} == "v1" ]]; then
continue
fi
SUBPATH="apis/"${ver%/*}
SWAGGER_JSON_NAME="${ver%/*}.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}${SUBPATH}" > "${SWAGGER_ROOT_DIR}/${SWAGGER_JSON_NAME}"
done
# fetch swagger specs for other discovery mechanism.
curl -w "\n" -fs "${SWAGGER_API_PATH}" > "${SWAGGER_ROOT_DIR}/resourceListing.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}version" > "${SWAGGER_ROOT_DIR}/version.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}api" > "${SWAGGER_ROOT_DIR}/api.json"
curl -w "\n" -fs "${SWAGGER_API_PATH}apis" > "${SWAGGER_ROOT_DIR}/apis.json"
kube::log::status "SUCCESS"
# ex: ts=2 sw=2 et filetype=sh

View File

@ -23,12 +23,4 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
BUILD_TARGETS=(
cmd/libs/go2idl/client-gen
cmd/libs/go2idl/conversion-gen
cmd/libs/go2idl/deepcopy-gen
cmd/libs/go2idl/set-gen
)
"${KUBE_ROOT}/hack/build-go.sh" ${BUILD_TARGETS[*]}
"${KUBE_ROOT}/hack/after-build/run-codegen.sh" --verify-only
"${KUBE_ROOT}/hack/update-codegen.sh" --verify-only

View File

@ -22,8 +22,67 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/genswaggertypedocs
"${KUBE_ROOT}/hack/after-build/verify-description.sh" "$@"
# Find binary
genswaggertypedocs=$(kube::util::find-binary "genswaggertypedocs")
# ex: ts=2 sw=2 et filetype=sh
gen_swagger_result=0
result=0
find_files() {
find . -not \( \
\( \
-wholename './output' \
-o -wholename './_output' \
-o -wholename './_gopath' \
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/vendor/*' \
\) -prune \
\) \
\( -wholename '*pkg/api/v*/types.go' \
-o -wholename '*pkg/apis/*/v*/types.go' \
-o -wholename '*pkg/api/unversioned/types.go' \
\)
}
if [[ $# -eq 0 ]]; then
versioned_api_files=$(find_files | egrep "pkg/.[^/]*/((v.[^/]*)|unversioned)/types\.go")
else
versioned_api_files="${*}"
fi
for file in $versioned_api_files; do
$genswaggertypedocs -v -s "${file}" -f - || gen_swagger_result=$?
if [[ "${gen_swagger_result}" -ne "0" ]]; then
echo "API file: ${file} is missing: ${gen_swagger_result} descriptions"
result=1
fi
if grep json: "${file}" | grep -v // | grep description: ; then
echo "API file: ${file} should not contain descriptions in struct tags"
result=1
fi
if grep json: "${file}" | grep -Ee ",[[:space:]]+omitempty|omitempty[[:space:]]+" ; then
echo "API file: ${file} should not contain leading or trailing spaces for omitempty directive"
result=1
fi
done
internal_types_files="${KUBE_ROOT}/pkg/api/types.go ${KUBE_ROOT}/pkg/apis/extensions/types.go"
for internal_types_file in $internal_types_files; do
if [[ ! -e $internal_types_file ]]; then
echo "Internal types file ${internal_types_file} does not exist"
result=1
continue
fi
if grep json: "${internal_types_file}" | grep -v // | grep description: ; then
echo "Internal API types should not contain descriptions"
result=1
fi
done
exit ${result}

View File

@ -23,8 +23,68 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendocs cmd/genkubedocs cmd/genman cmd/genyaml cmd/genbashcomp cmd/mungedocs
"${KUBE_ROOT}/hack/build-go.sh" \
cmd/gendocs \
cmd/genkubedocs \
cmd/genman \
cmd/genyaml \
cmd/genbashcomp \
cmd/mungedocs
"${KUBE_ROOT}/hack/after-build/verify-generated-docs.sh" "$@"
# Find binary
gendocs=$(kube::util::find-binary "gendocs")
genkubedocs=$(kube::util::find-binary "genkubedocs")
genman=$(kube::util::find-binary "genman")
genyaml=$(kube::util::find-binary "genyaml")
genbashcomp=$(kube::util::find-binary "genbashcomp")
mungedocs=$(kube::util::find-binary "mungedocs")
DOCROOT="${KUBE_ROOT}/docs/"
EXAMPLEROOT="${KUBE_ROOT}/examples/"
# mungedocs --verify can (and should) be run on the real docs, otherwise their
# links will be distorted. --verify means that it will not make changes.
# --verbose gives us output we can use for a diff.
"${mungedocs}" "--verify=true" "--verbose=true" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${DOCROOT}" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${DOCROOT} is out of date. Please run hack/update-generated-docs.sh"
exit 1
fi
if [[ $ret -gt 1 ]]; then
echo "Error running mungedocs"
exit 1
fi
"${mungedocs}" "--verify=true" "--verbose=true" "--upstream=${KUBE_GIT_UPSTREAM}" "--root-dir=${EXAMPLEROOT}" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${EXAMPLEROOT} is out of date. Please run hack/update-generated-docs.sh"
exit 1
fi
if [[ $ret -gt 1 ]]; then
echo "Error running mungedocs"
exit 1
fi
kube::util::ensure-temp-dir
kube::util::gen-docs "${KUBE_TEMP}"
diff -Naup "${KUBE_TEMP}/.generated_docs" "${KUBE_ROOT}/.generated_docs" || ret=1 || true
while read file; do
diff -Naup "${KUBE_TEMP}/${file}" "${KUBE_ROOT}/${file}" || ret=1 || true
done <"${KUBE_TEMP}/.generated_docs"
needsanalytics=($(kube::util::gen-analytics "${KUBE_ROOT}" 1))
if [[ ${#needsanalytics[@]} -ne 0 ]]; then
echo -e "Some md files are missing ga-beacon analytics link:"
printf '%s\n' "${needsanalytics[@]}"
ret=1
fi
if [[ $ret -eq 0 ]]
then
echo "Generated docs are up to date."
else
echo "Generated docs are out of date. Please run hack/update-generated-docs.sh"
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -23,6 +23,39 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/after-build/verify-generated-protobuf.sh" "$@"
APIROOTS=${APIROOTS:-pkg/api pkg/apis pkg/runtime pkg/util/intstr pkg/watch}
_tmp="${KUBE_ROOT}/_tmp"
# ex: ts=2 sw=2 et filetype=sh
cleanup() {
rm -rf "${_tmp}"
}
trap "cleanup" EXIT SIGINT
cleanup
for APIROOT in ${APIROOTS}; do
mkdir -p "${_tmp}/${APIROOT%/*}"
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
done
# If not running as root, we need to use sudo to restore the original generated
# protobuf files.
SUDO=""
if [[ "$(id -u)" != '0' ]]; then
SUDO="sudo"
fi
"${KUBE_ROOT}/hack/update-generated-protobuf.sh"
for APIROOT in ${APIROOTS}; do
TMP_APIROOT="${_tmp}/${APIROOT}"
echo "diffing ${APIROOT} against freshly generated protobuf"
ret=0
diff -Naupr -I 'Auto generated by' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
${SUDO} cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/${APIROOT%/*}"
if [[ $ret -eq 0 ]]; then
echo "${APIROOT} up to date."
else
echo "${APIROOT} is out of date. Please run hack/update-generated-protobuf.sh"
exit 1
fi
done

View File

@ -25,4 +25,36 @@ kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/genswaggertypedocs
"${KUBE_ROOT}/hack/after-build/verify-generated-swagger-docs.sh" "$@"
# Find binary
genswaggertypedocs=$(kube::util::find-binary "genswaggertypedocs")
if [[ ! -x "$genswaggertypedocs" ]]; then
{
echo "It looks as if you don't have a compiled genswaggertypedocs binary"
echo
echo "If you are running from a clone of the git repo, please run"
echo "'./hack/build-go.sh cmd/genswaggertypedocs'."
} >&2
exit 1
fi
DIFFROOT="${KUBE_ROOT}/pkg"
TMP_DIFFROOT="${KUBE_ROOT}/_tmp/pkg"
_tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${DIFFROOT}" "${TMP_DIFFROOT}"
"${KUBE_ROOT}/hack/update-generated-swagger-docs.sh"
echo "diffing ${DIFFROOT} against freshly generated swagger type documentation"
ret=0
diff -Naupr -I 'Auto generated by' "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
cp -a "${TMP_DIFFROOT}" "${KUBE_ROOT}/"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
echo "${DIFFROOT} up to date."
else
echo "${DIFFROOT} is out of date. Please run hack/update-generated-swagger-docs.sh"
exit 1
fi

View File

@ -25,4 +25,4 @@ kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/import-boss
"${KUBE_ROOT}/hack/after-build/run-import-boss.sh" --verify-only
$(kube::util::find-binary "import-boss") --verify-only

View File

@ -25,6 +25,37 @@ kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/linkcheck
"${KUBE_ROOT}/hack/after-build/verify-linkcheck.sh" "$@"
linkcheck=$(kube::util::find-binary "linkcheck")
kube::util::ensure-temp-dir
OUTPUT="${KUBE_TEMP}"/linkcheck-output
cleanup() {
rm -rf "${OUTPUT}"
}
trap "cleanup" EXIT SIGINT
mkdir -p "$OUTPUT"
APIROOT="${KUBE_ROOT}/pkg/api/"
APISROOT="${KUBE_ROOT}/pkg/apis/"
DOCROOT="${KUBE_ROOT}/docs/"
ROOTS=($APIROOT $APISROOT $DOCROOT)
found_invalid=false
for root in "${ROOTS[@]}"; do
"${linkcheck}" "--root-dir=${root}" 2> >(tee -a "${OUTPUT}/error" >&2) && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "Failed: found invalid links in ${root}."
found_invalid=true
fi
if [[ $ret -gt 1 ]]; then
echo "Error running linkcheck"
exit 1
fi
done
if [ ${found_invalid} = true ]; then
echo "Summary of invalid links:"
cat ${OUTPUT}/error
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -25,6 +25,27 @@ kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/kube-apiserver
"${KUBE_ROOT}/hack/after-build/verify-swagger-spec.sh" "$@"
apiserver=$(kube::util::find-binary "kube-apiserver")
SPECROOT="${KUBE_ROOT}/api/swagger-spec"
TMP_SPECROOT="${KUBE_ROOT}/_tmp/swagger-spec"
_tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
"${KUBE_ROOT}/hack/update-swagger-spec.sh"
echo "diffing ${SPECROOT} against freshly generated swagger spec"
ret=0
diff -Naupr -I 'Auto generated by' "${SPECROOT}" "${TMP_SPECROOT}" || ret=$?
cp -a ${TMP_SPECROOT} "${KUBE_ROOT}/api"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
echo "${SPECROOT} up to date."
else
echo "${SPECROOT} is out of date. Please run hack/update-swagger-spec.sh"
exit 1
fi
# ex: ts=2 sw=2 et filetype=sh

View File

@ -25,6 +25,25 @@ kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/hyperkube
"${KUBE_ROOT}/hack/after-build/verify-symbols.sh"
# add other BADSYMBOLS here.
BADSYMBOLS=(
"httptest"
"testify"
"testing[.]"
)
# b/c hyperkube binds everything simply check that for bad symbols
SYMBOLS="$(nm ${KUBE_OUTPUT_HOSTBIN}/hyperkube)"
RESULT=0
for BADSYMBOL in "${BADSYMBOLS[@]}"; do
if FOUND=$(echo "$SYMBOLS" | grep "$BADSYMBOL"); then
echo "Found bad symbol '${BADSYMBOL}':"
echo "$FOUND"
RESULT=1
fi
done
exit $RESULT
# ex: ts=2 sw=2 et filetype=sh

View File

@ -103,7 +103,7 @@ files_need_description=()
# Check API schema definitions for field descriptions
for file in $(git diff --cached --name-only --diff-filter ACM | egrep "pkg/api/v.[^/]*/types\.go" | grep -v "third_party"); do
# Check for files with fields without description tags
descriptionless=$(hack/after-build/verify-description.sh "${file}" > /dev/null; echo $?)
descriptionless=$(hack/verify-description.sh "${file}" > /dev/null; echo $?)
if [[ "$descriptionless" -ne "0" ]]; then
files_need_description+=("${file}")
fi
@ -123,7 +123,7 @@ fi
echo "${reset}"
echo -ne "Checking for docs that need updating... "
if ! hack/after-build/verify-generated-docs.sh > /dev/null; then
if ! hack/verify-generated-docs.sh > /dev/null; then
echo "${red}ERROR!"
echo "Some docs are out of sync between CLI and markdown."
echo "To regenerate docs, run:"
@ -135,7 +135,7 @@ fi
echo "${reset}"
echo -ne "Checking for swagger type documentation that need updating... "
if ! hack/after-build/verify-generated-swagger-docs.sh > /dev/null; then
if ! hack/verify-generated-swagger-docs.sh > /dev/null; then
echo "${red}ERROR!"
echo "Swagger type documentation needs to be updated."
echo "To regenerate the spec, run:"
@ -147,7 +147,7 @@ fi
echo "${reset}"
echo -ne "Checking for swagger spec that need updating... "
if ! hack/after-build/verify-swagger-spec.sh > /dev/null; then
if ! hack/verify-swagger-spec.sh > /dev/null; then
echo "${red}ERROR!"
echo "Swagger spec needs to be updated."
echo "To regenerate the spec, run:"