Add generated file
This PR adds generated files under pkg/client and vendor folder.
This commit is contained in:
112
vendor/k8s.io/kubernetes/hack/make-rules/BUILD
generated
vendored
Normal file
112
vendor/k8s.io/kubernetes/hack/make-rules/BUILD
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
# Scripts runnable from make, e.g.
|
||||
#
|
||||
# cd $GOPATH/src/k8s.io/kubernetes
|
||||
# make test-e2e-node
|
||||
#
|
||||
# The sh_binary rules below exist only to validate
|
||||
# dependencies; if a shell dependency is accidentally
|
||||
# deleted, a presubmit BUILD will fail.
|
||||
#
|
||||
# If the scripts sourced their dependencies from
|
||||
# $RUNFILES (rather than $BASH_SOURCE/../.. or
|
||||
# whatever), then bazel build hack/... would install
|
||||
# runnable, hermetically sealed shell "binaries".
|
||||
# E.g. the following command would work:
|
||||
#
|
||||
# ./bazel-bin/hack/make-rules/test-e2e-node
|
||||
#
|
||||
# TODO(#47064): Should be a sh_test instead of sh_binary
|
||||
sh_binary(
|
||||
name = "test-cmd",
|
||||
srcs = ["test-cmd.sh"],
|
||||
deps = [
|
||||
":test-cmd-util",
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "test-e2e-node",
|
||||
srcs = ["test-e2e-node.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "test-integration",
|
||||
srcs = ["test-cmd.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "test-kubeadm-cmd",
|
||||
srcs = ["test-kubeadm-cmd.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "build",
|
||||
srcs = ["build.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "cross",
|
||||
srcs = ["cross.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "test",
|
||||
srcs = ["test.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "vet",
|
||||
srcs = ["vet.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_binary(
|
||||
name = "verify",
|
||||
srcs = ["verify.sh"],
|
||||
deps = [
|
||||
"//hack/lib",
|
||||
],
|
||||
)
|
||||
|
||||
sh_library(
|
||||
name = "test-cmd-util",
|
||||
srcs = [
|
||||
"test-cmd-util.sh",
|
||||
],
|
||||
data = ["//pkg/kubectl/validation:testdata/v1/validPod.yaml"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
30
vendor/k8s.io/kubernetes/hack/make-rules/Makefile.manifest
generated
vendored
Normal file
30
vendor/k8s.io/kubernetes/hack/make-rules/Makefile.manifest
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
.PHONY: manifest-tool
|
||||
|
||||
MANIFEST_TOOL_DIR := $(shell mktemp -d)
|
||||
export PATH := $(MANIFEST_TOOL_DIR):$(PATH)
|
||||
|
||||
MANIFEST_TOOL_VERSION := v0.7.0
|
||||
|
||||
space :=
|
||||
space +=
|
||||
comma := ,
|
||||
prefix_linux = $(addprefix linux/,$(strip $1))
|
||||
join_platforms = $(subst $(space),$(comma),$(call prefix_linux,$(strip $1)))
|
||||
|
||||
manifest-tool:
|
||||
curl -sSL https://github.com/estesp/manifest-tool/releases/download/$(MANIFEST_TOOL_VERSION)/manifest-tool-linux-amd64 > $(MANIFEST_TOOL_DIR)/manifest-tool
|
||||
chmod +x $(MANIFEST_TOOL_DIR)/manifest-tool
|
28
vendor/k8s.io/kubernetes/hack/make-rules/build.sh
generated
vendored
Executable file
28
vendor/k8s.io/kubernetes/hack/make-rules/build.sh
generated
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# This script sets up a go workspace locally and builds all go components.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
KUBE_VERBOSE="${KUBE_VERBOSE:-1}"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::build_binaries "$@"
|
||||
kube::golang::place_bins
|
39
vendor/k8s.io/kubernetes/hack/make-rules/clean.sh
generated
vendored
Executable file
39
vendor/k8s.io/kubernetes/hack/make-rules/clean.sh
generated
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# 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/util.sh"
|
||||
|
||||
CLEAN_PATTERNS=(
|
||||
"_tmp"
|
||||
"doc_tmp"
|
||||
".*/zz_generated.openapi.go"
|
||||
"pkg/generated/bindata.go"
|
||||
"test/e2e/generated/bindata.go"
|
||||
)
|
||||
|
||||
for pattern in ${CLEAN_PATTERNS[@]}; do
|
||||
for match in $(find "${KUBE_ROOT}" -iregex "^${KUBE_ROOT}/${pattern}$"); do
|
||||
echo "Removing ${match#${KUBE_ROOT}\/} .."
|
||||
rm -rf "${match#${KUBE_ROOT}\/}"
|
||||
done
|
||||
done
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
38
vendor/k8s.io/kubernetes/hack/make-rules/cross.sh
generated
vendored
Executable file
38
vendor/k8s.io/kubernetes/hack/make-rules/cross.sh
generated
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# This script sets up a go workspace locally and builds all for all appropriate
|
||||
# platforms.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
# NOTE: Using "${array[*]}" here is correct. [@] becomes distinct words (in
|
||||
# bash parlance).
|
||||
|
||||
make all WHAT="${KUBE_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_NODE_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_NODE_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_TEST_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_PLATFORMS[*]}"
|
||||
|
||||
make all WHAT="${KUBE_TEST_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_SERVER_PLATFORMS[*]}"
|
72
vendor/k8s.io/kubernetes/hack/make-rules/helpers/cache_go_dirs.sh
generated
vendored
Executable file
72
vendor/k8s.io/kubernetes/hack/make-rules/helpers/cache_go_dirs.sh
generated
vendored
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# This script finds, caches, and prints a list of all directories that hold
|
||||
# *.go files. If any directory is newer than the cache, re-find everything and
|
||||
# update the cache. Otherwise use the cached file.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
if [[ -z "${1:-}" ]]; then
|
||||
echo "usage: $0 <cache-file>"
|
||||
exit 1
|
||||
fi
|
||||
CACHE="$1"; shift
|
||||
|
||||
trap "rm -f '${CACHE}'" HUP INT TERM ERR
|
||||
|
||||
# This is a partial 'find' command. The caller is expected to pass the
|
||||
# remaining arguments.
|
||||
#
|
||||
# Example:
|
||||
# kfind -type f -name foobar.go
|
||||
function kfind() {
|
||||
# include the "special" vendor directories which are actually part
|
||||
# of the Kubernetes source tree - generators will use these for
|
||||
# including certain core API concepts.
|
||||
find -H . ./vendor/k8s.io/apimachinery ./vendor/k8s.io/apiserver ./vendor/k8s.io/kube-aggregator ./vendor/k8s.io/apiextensions-apiserver ./vendor/k8s.io/metrics ./vendor/k8s.io/sample-apiserver ./vendor/k8s.io/api ./vendor/k8s.io/client-go ./vendor/k8s.io/code-generator ./vendor/k8s.io/sample-controller \
|
||||
\( \
|
||||
-not \( \
|
||||
\( \
|
||||
-path ./vendor -o \
|
||||
-path ./staging -o \
|
||||
-path ./_\* -o \
|
||||
-path ./.\* -o \
|
||||
-path ./docs \
|
||||
\) -prune \
|
||||
\) \
|
||||
\) \
|
||||
"$@"
|
||||
}
|
||||
|
||||
NEED_FIND=true
|
||||
# It's *significantly* faster to check whether any directories are newer than
|
||||
# the cache than to blindly rebuild it.
|
||||
if [[ -f "${CACHE}" ]]; then
|
||||
N=$(kfind -type d -newer "${CACHE}" -print -quit | wc -l)
|
||||
[[ "${N}" == 0 ]] && NEED_FIND=false
|
||||
fi
|
||||
mkdir -p $(dirname "${CACHE}")
|
||||
if $("${NEED_FIND}"); then
|
||||
kfind -type f -name \*.go \
|
||||
| sed 's|/[^/]*$||' \
|
||||
| sed 's|^./||' \
|
||||
| LC_ALL=C sort -u \
|
||||
> "${CACHE}"
|
||||
fi
|
||||
cat "${CACHE}"
|
50
vendor/k8s.io/kubernetes/hack/make-rules/make-help.sh
generated
vendored
Executable file
50
vendor/k8s.io/kubernetes/hack/make-rules/make-help.sh
generated
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# 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
|
||||
|
||||
readonly red=$(tput setaf 1)
|
||||
readonly reset=$(tput sgr0)
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
ALL_TARGETS=$(make -C "${KUBE_ROOT}" PRINT_HELP=y -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/ { s/:.*$// ; p ; } ; }' | sort)
|
||||
CMD_TARGETS=$(ls -l "${KUBE_ROOT}/cmd" |awk '/^d/ {print $NF}')
|
||||
CMD_FLAG=false
|
||||
PLUGIN_CMD_FLAG=false
|
||||
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
for tar in $ALL_TARGETS; do
|
||||
for cmdtar in $CMD_TARGETS; do
|
||||
if [ $tar = $cmdtar ]; then
|
||||
if [ $CMD_FLAG = true ]; then
|
||||
continue 2;
|
||||
fi
|
||||
|
||||
echo -e "${red}${CMD_TARGETS}${reset}"
|
||||
make -C "${KUBE_ROOT}" $tar PRINT_HELP=y
|
||||
echo "---------------------------------------------------------------------------------"
|
||||
|
||||
CMD_FLAG=true
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "${red}${tar}${reset}"
|
||||
make -C "${KUBE_ROOT}" $tar PRINT_HELP=y
|
||||
echo "---------------------------------------------------------------------------------"
|
||||
done
|
5693
vendor/k8s.io/kubernetes/hack/make-rules/test-cmd-util.sh
generated
vendored
Executable file
5693
vendor/k8s.io/kubernetes/hack/make-rules/test-cmd-util.sh
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
107
vendor/k8s.io/kubernetes/hack/make-rules/test-cmd.sh
generated
vendored
Executable file
107
vendor/k8s.io/kubernetes/hack/make-rules/test-cmd.sh
generated
vendored
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# This command checks that the built commands can function together for
|
||||
# simple scenarios. It does not require Docker.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/test.sh"
|
||||
source "${KUBE_ROOT}/hack/make-rules/test-cmd-util.sh"
|
||||
|
||||
function run_kube_apiserver() {
|
||||
kube::log::status "Building kube-apiserver"
|
||||
make -C "${KUBE_ROOT}" WHAT="cmd/kube-apiserver"
|
||||
|
||||
# Start kube-apiserver
|
||||
kube::log::status "Starting kube-apiserver"
|
||||
|
||||
# Admission Controllers to invoke prior to persisting objects in cluster
|
||||
ENABLE_ADMISSION_PLUGINS="Initializers,LimitRanger,ResourceQuota"
|
||||
DISABLE_ADMISSION_PLUGINS="ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook"
|
||||
|
||||
# Include RBAC (to exercise bootstrapping), and AlwaysAllow to allow all actions
|
||||
AUTHORIZATION_MODE="RBAC,AlwaysAllow"
|
||||
|
||||
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
--insecure-bind-address="127.0.0.1" \
|
||||
--bind-address="127.0.0.1" \
|
||||
--insecure-port="${API_PORT}" \
|
||||
--authorization-mode="${AUTHORIZATION_MODE}" \
|
||||
--secure-port="${SECURE_API_PORT}" \
|
||||
--enable-admission-plugins="${ENABLE_ADMISSION_PLUGINS}" \
|
||||
--disable-admission-plugins="${DISABLE_ADMISSION_PLUGINS}" \
|
||||
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||
--runtime-config=api/v1 \
|
||||
--storage-media-type="${KUBE_TEST_API_STORAGE_TYPE-}" \
|
||||
--cert-dir="${TMPDIR:-/tmp/}" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" \
|
||||
--token-auth-file=hack/testdata/auth-tokens.csv 1>&2 &
|
||||
APISERVER_PID=$!
|
||||
|
||||
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/healthz" "apiserver"
|
||||
}
|
||||
|
||||
function run_kube_controller_manager() {
|
||||
kube::log::status "Building kube-controller-manager"
|
||||
make -C "${KUBE_ROOT}" WHAT="cmd/kube-controller-manager"
|
||||
|
||||
# Start controller manager
|
||||
kube::log::status "Starting controller-manager"
|
||||
"${KUBE_OUTPUT_HOSTBIN}/kube-controller-manager" \
|
||||
--port="${CTLRMGR_PORT}" \
|
||||
--kube-api-content-type="${KUBE_TEST_API_TYPE-}" \
|
||||
--master="127.0.0.1:${API_PORT}" 1>&2 &
|
||||
CTLRMGR_PID=$!
|
||||
|
||||
kube::util::wait_for_url "http://127.0.0.1:${CTLRMGR_PORT}/healthz" "controller-manager"
|
||||
}
|
||||
|
||||
# Creates a node object with name 127.0.0.1. This is required because we do not
|
||||
# run kubelet.
|
||||
function create_node() {
|
||||
kubectl create -f - -s "http://127.0.0.1:${API_PORT}" << __EOF__
|
||||
{
|
||||
"kind": "Node",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "127.0.0.1"
|
||||
},
|
||||
"status": {
|
||||
"capacity": {
|
||||
"memory": "1Gi"
|
||||
}
|
||||
}
|
||||
}
|
||||
__EOF__
|
||||
}
|
||||
|
||||
kube::log::status "Running kubectl tests for kube-apiserver"
|
||||
|
||||
setup
|
||||
run_kube_apiserver
|
||||
run_kube_controller_manager
|
||||
create_node
|
||||
SUPPORTED_RESOURCES=("*")
|
||||
# WARNING: Do not wrap this call in a subshell to capture output, e.g. output=$(runTests)
|
||||
# Doing so will suppress errexit behavior inside runTests
|
||||
runTests
|
||||
|
||||
kube::log::status "TESTS PASSED"
|
177
vendor/k8s.io/kubernetes/hack/make-rules/test-e2e-node.sh
generated
vendored
Executable file
177
vendor/k8s.io/kubernetes/hack/make-rules/test-e2e-node.sh
generated
vendored
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
focus=${FOCUS:-""}
|
||||
skip=${SKIP-"\[Flaky\]|\[Slow\]|\[Serial\]"}
|
||||
# The number of tests that can run in parallel depends on what tests
|
||||
# are running and on the size of the node. Too many, and tests will
|
||||
# fail due to resource contention. 8 is a reasonable default for a
|
||||
# n1-standard-1 node.
|
||||
# Currently, parallelism only affects when REMOTE=true. For local test,
|
||||
# ginkgo default parallelism (cores - 1) is used.
|
||||
parallelism=${PARALLELISM:-8}
|
||||
artifacts=${ARTIFACTS:-"/tmp/_artifacts/`date +%y%m%dT%H%M%S`"}
|
||||
remote=${REMOTE:-"false"}
|
||||
runtime=${RUNTIME:-"docker"}
|
||||
container_runtime_endpoint=${CONTAINER_RUNTIME_ENDPOINT:-""}
|
||||
image_service_endpoint=${IMAGE_SERVICE_ENDPOINT:-""}
|
||||
run_until_failure=${RUN_UNTIL_FAILURE:-"false"}
|
||||
test_args=${TEST_ARGS:-""}
|
||||
system_spec_name=${SYSTEM_SPEC_NAME:-}
|
||||
|
||||
# Parse the flags to pass to ginkgo
|
||||
ginkgoflags=""
|
||||
if [[ $parallelism > 1 ]]; then
|
||||
ginkgoflags="$ginkgoflags -nodes=$parallelism "
|
||||
fi
|
||||
|
||||
if [[ $focus != "" ]]; then
|
||||
ginkgoflags="$ginkgoflags -focus=\"$focus\" "
|
||||
fi
|
||||
|
||||
if [[ $skip != "" ]]; then
|
||||
ginkgoflags="$ginkgoflags -skip=\"$skip\" "
|
||||
fi
|
||||
|
||||
if [[ $run_until_failure != "" ]]; then
|
||||
ginkgoflags="$ginkgoflags -untilItFails=$run_until_failure "
|
||||
fi
|
||||
|
||||
# Setup the directory to copy test artifacts (logs, junit.xml, etc) from remote host to local host
|
||||
if [ ! -d "${artifacts}" ]; then
|
||||
echo "Creating artifacts directory at ${artifacts}"
|
||||
mkdir -p ${artifacts}
|
||||
fi
|
||||
echo "Test artifacts will be written to ${artifacts}"
|
||||
|
||||
if [[ $runtime == "remote" ]] ; then
|
||||
if [[ ! -z $container_runtime_endpoint ]] ; then
|
||||
test_args="--container-runtime-endpoint=${container_runtime_endpoint} $test_args"
|
||||
fi
|
||||
if [[ ! -z $image_service_endpoint ]] ; then
|
||||
test_args="--image-service-endpoint=$image_service_endpoint $test_args"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ $remote = true ] ; then
|
||||
# The following options are only valid in remote run.
|
||||
images=${IMAGES:-""}
|
||||
hosts=${HOSTS:-""}
|
||||
image_project=${IMAGE_PROJECT:-"kubernetes-node-e2e-images"}
|
||||
metadata=${INSTANCE_METADATA:-""}
|
||||
list_images=${LIST_IMAGES:-false}
|
||||
if [[ $list_images == "true" ]]; then
|
||||
gcloud compute images list --project="${image_project}" | grep "e2e-node"
|
||||
exit 0
|
||||
fi
|
||||
gubernator=${GUBERNATOR:-"false"}
|
||||
image_config_file=${IMAGE_CONFIG_FILE:-""}
|
||||
if [[ $hosts == "" && $images == "" && $image_config_file == "" ]]; then
|
||||
image_project=${IMAGE_PROJECT:-"cos-cloud"}
|
||||
gci_image=$(gcloud compute images list --project $image_project \
|
||||
--no-standard-images --filter="name ~ 'cos-beta.*'" --format="table[no-heading](name)")
|
||||
images=$gci_image
|
||||
metadata="user-data<${KUBE_ROOT}/test/e2e_node/jenkins/gci-init.yaml,gci-update-strategy=update_disabled"
|
||||
fi
|
||||
instance_prefix=${INSTANCE_PREFIX:-"test"}
|
||||
cleanup=${CLEANUP:-"true"}
|
||||
delete_instances=${DELETE_INSTANCES:-"false"}
|
||||
test_suite=${TEST_SUITE:-"default"}
|
||||
|
||||
# Get the compute zone
|
||||
zone=$(gcloud info --format='value(config.properties.compute.zone)')
|
||||
if [[ $zone == "" ]]; then
|
||||
echo "Could not find gcloud compute/zone when running: \`gcloud info --format='value(config.properties.compute.zone)'\`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the compute project
|
||||
project=$(gcloud info --format='value(config.project)')
|
||||
if [[ $project == "" ]]; then
|
||||
echo "Could not find gcloud project when running: \`gcloud info --format='value(config.project)'\`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if any of the images specified already have running instances. If so reuse those instances
|
||||
# by moving the IMAGE to a HOST
|
||||
if [[ $images != "" ]]; then
|
||||
IFS=',' read -ra IM <<< "$images"
|
||||
images=""
|
||||
for i in "${IM[@]}"; do
|
||||
if [[ $(gcloud compute instances list "${instance_prefix}-$i" | grep $i) ]]; then
|
||||
if [[ $hosts != "" ]]; then
|
||||
hosts="$hosts,"
|
||||
fi
|
||||
echo "Reusing host ${instance_prefix}-$i"
|
||||
hosts="${hosts}${instance_prefix}-${i}"
|
||||
else
|
||||
if [[ $images != "" ]]; then
|
||||
images="$images,"
|
||||
fi
|
||||
images="$images$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Output the configuration we will try to run
|
||||
echo "Running tests remotely using"
|
||||
echo "Project: $project"
|
||||
echo "Image Project: $image_project"
|
||||
echo "Compute/Zone: $zone"
|
||||
echo "Images: $images"
|
||||
echo "Hosts: $hosts"
|
||||
echo "Ginkgo Flags: $ginkgoflags"
|
||||
echo "Instance Metadata: $metadata"
|
||||
echo "Image Config File: $image_config_file"
|
||||
# Invoke the runner
|
||||
go run test/e2e_node/runner/remote/run_remote.go --logtostderr --vmodule=*=4 --ssh-env="gce" \
|
||||
--zone="$zone" --project="$project" --gubernator="$gubernator" \
|
||||
--hosts="$hosts" --images="$images" --cleanup="$cleanup" \
|
||||
--results-dir="$artifacts" --ginkgo-flags="$ginkgoflags" \
|
||||
--image-project="$image_project" --instance-name-prefix="$instance_prefix" \
|
||||
--delete-instances="$delete_instances" --test_args="$test_args" --instance-metadata="$metadata" \
|
||||
--image-config-file="$image_config_file" --system-spec-name="$system_spec_name" \
|
||||
--test-suite="$test_suite" \
|
||||
2>&1 | tee -i "${artifacts}/build-log.txt"
|
||||
exit $?
|
||||
|
||||
else
|
||||
# Refresh sudo credentials for local run
|
||||
if ! ping -c 1 -q metadata.google.internal &> /dev/null; then
|
||||
echo "Updating sudo credentials"
|
||||
sudo -v || exit 1
|
||||
fi
|
||||
|
||||
# Do not use any network plugin by default. User could override the flags with
|
||||
# test_args.
|
||||
test_args='--kubelet-flags="--network-plugin= --cni-bin-dir=" '$test_args
|
||||
|
||||
# Runtime flags
|
||||
test_args='--kubelet-flags="--container-runtime='$runtime'" '$test_args
|
||||
|
||||
# Test using the host the script was run on
|
||||
# Provided for backwards compatibility
|
||||
go run test/e2e_node/runner/local/run_local.go \
|
||||
--system-spec-name="$system_spec_name" --ginkgo-flags="$ginkgoflags" \
|
||||
--test-flags="--container-runtime=${runtime} \
|
||||
--alsologtostderr --v 4 --report-dir=${artifacts} --node-name $(hostname) \
|
||||
$test_args" --build-dependencies=true 2>&1 | tee -i "${artifacts}/build-log.txt"
|
||||
exit $?
|
||||
fi
|
106
vendor/k8s.io/kubernetes/hack/make-rules/test-integration.sh
generated
vendored
Executable file
106
vendor/k8s.io/kubernetes/hack/make-rules/test-integration.sh
generated
vendored
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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"
|
||||
# Lists of API Versions of each groups that should be tested, groups are
|
||||
# separated by comma, lists are separated by semicolon. e.g.,
|
||||
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
|
||||
# TODO: It's going to be:
|
||||
# KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1"}
|
||||
# FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go)
|
||||
# ONLY the last version is tested in each group.
|
||||
ALL_VERSIONS_CSV=$(IFS=',';echo "${KUBE_AVAILABLE_GROUP_VERSIONS[*]// /,}";IFS=$)
|
||||
KUBE_TEST_API_VERSIONS="${KUBE_TEST_API_VERSIONS:-${ALL_VERSIONS_CSV}}"
|
||||
|
||||
# Give integration tests longer to run by default.
|
||||
KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 600s}
|
||||
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
||||
LOG_LEVEL=${LOG_LEVEL:-2}
|
||||
KUBE_TEST_ARGS=${KUBE_TEST_ARGS:-}
|
||||
# Default glog module settings.
|
||||
KUBE_TEST_VMODULE=${KUBE_TEST_VMODULE:-"garbagecollector*=6,graph_builder*=6"}
|
||||
|
||||
kube::test::find_integration_test_dirs() {
|
||||
(
|
||||
cd ${KUBE_ROOT}
|
||||
find test/integration/ -name '*_test.go' -print0 \
|
||||
| xargs -0n1 dirname | sed "s|^|${KUBE_GO_PACKAGE}/|" \
|
||||
| LC_ALL=C sort -u
|
||||
find vendor/k8s.io/apiextensions-apiserver/test/integration/ -name '*_test.go' -print0 \
|
||||
| xargs -0n1 dirname | sed "s|^|${KUBE_GO_PACKAGE}/|" \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
}
|
||||
|
||||
CLEANUP_REQUIRED=
|
||||
cleanup() {
|
||||
if [[ -z "${CLEANUP_REQUIRED}" ]]; then
|
||||
return
|
||||
fi
|
||||
kube::log::status "Cleaning up etcd"
|
||||
kube::etcd::cleanup
|
||||
CLEANUP_REQUIRED=
|
||||
kube::log::status "Integration test cleanup complete"
|
||||
}
|
||||
|
||||
runTests() {
|
||||
kube::log::status "Starting etcd instance"
|
||||
CLEANUP_REQUIRED=1
|
||||
kube::etcd::start
|
||||
kube::log::status "Running integration test cases"
|
||||
|
||||
KUBE_RACE="-race"
|
||||
make -C "${KUBE_ROOT}" test \
|
||||
WHAT="${WHAT:-$(kube::test::find_integration_test_dirs | paste -sd' ' -)}" \
|
||||
GOFLAGS="${GOFLAGS:-}" \
|
||||
KUBE_TEST_ARGS="${KUBE_TEST_ARGS:-} ${SHORT:--short=true} --vmodule=${KUBE_TEST_VMODULE} --alsologtostderr=true" \
|
||||
KUBE_RACE="" \
|
||||
KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
|
||||
KUBE_TEST_API_VERSIONS="$1"
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
checkEtcdOnPath() {
|
||||
kube::log::status "Checking etcd is on PATH"
|
||||
which etcd && return
|
||||
kube::log::status "Cannot find etcd, cannot run integration tests."
|
||||
kube::log::status "Please see https://github.com/kubernetes/community/blob/master/contributors/devel/testing.md#install-etcd-dependency for instructions."
|
||||
kube::log::usage "You can use 'hack/install-etcd.sh' to install a copy in third_party/."
|
||||
return 1
|
||||
}
|
||||
|
||||
checkEtcdOnPath
|
||||
|
||||
# Run cleanup to stop etcd on interrupt or other kill signal.
|
||||
trap cleanup EXIT
|
||||
|
||||
# If a test case is specified, just run once with v1 API version and exit
|
||||
if [[ -n "${KUBE_TEST_ARGS}" ]]; then
|
||||
runTests v1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Convert the CSV to an array of API versions to test
|
||||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
||||
for apiVersion in "${apiVersions[@]}"; do
|
||||
runTests "${apiVersion}"
|
||||
done
|
32
vendor/k8s.io/kubernetes/hack/make-rules/test-kubeadm-cmd.sh
generated
vendored
Executable file
32
vendor/k8s.io/kubernetes/hack/make-rules/test-kubeadm-cmd.sh
generated
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# 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"
|
||||
|
||||
KUBEADM_PATH="${KUBEADM_PATH:=$(kube::realpath "${KUBE_ROOT}")/cluster/kubeadm.sh}"
|
||||
|
||||
# If testing a different version of kubeadm than the current build, you can
|
||||
# comment this out to save yourself from needlessly building here.
|
||||
make -C "${KUBE_ROOT}" WHAT=cmd/kubeadm
|
||||
|
||||
make -C "${KUBE_ROOT}" test \
|
||||
WHAT=k8s.io/kubernetes/cmd/kubeadm/test/cmd \
|
||||
KUBE_TEST_ARGS="--kubeadm-path '${KUBEADM_PATH}'"
|
392
vendor/k8s.io/kubernetes/hack/make-rules/test.sh
generated
vendored
Executable file
392
vendor/k8s.io/kubernetes/hack/make-rules/test.sh
generated
vendored
Executable file
@@ -0,0 +1,392 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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
|
||||
|
||||
# start the cache mutation detector by default so that cache mutators will be found
|
||||
KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}"
|
||||
export KUBE_CACHE_MUTATION_DETECTOR
|
||||
|
||||
# panic the server on watch decode errors since they are considered coder mistakes
|
||||
KUBE_PANIC_WATCH_DECODE_ERROR="${KUBE_PANIC_WATCH_DECODE_ERROR:-true}"
|
||||
export KUBE_PANIC_WATCH_DECODE_ERROR
|
||||
|
||||
# Handle case where OS has sha#sum commands, instead of shasum.
|
||||
if which shasum >/dev/null 2>&1; then
|
||||
SHA1SUM="shasum -a1"
|
||||
elif which sha1sum >/dev/null 2>&1; then
|
||||
SHA1SUM="sha1sum"
|
||||
else
|
||||
echo "Failed to find shasum or sha1sum utility." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kube::test::find_dirs() {
|
||||
(
|
||||
cd ${KUBE_ROOT}
|
||||
find -L . -not \( \
|
||||
\( \
|
||||
-path './_artifacts/*' \
|
||||
-o -path './bazel-*/*' \
|
||||
-o -path './_output/*' \
|
||||
-o -path './_gopath/*' \
|
||||
-o -path './cmd/kubeadm/test/*' \
|
||||
-o -path './contrib/podex/*' \
|
||||
-o -path './output/*' \
|
||||
-o -path './release/*' \
|
||||
-o -path './target/*' \
|
||||
-o -path './test/e2e/*' \
|
||||
-o -path './test/e2e_node/*' \
|
||||
-o -path './test/e2e_kubeadm/*' \
|
||||
-o -path './test/integration/*' \
|
||||
-o -path './third_party/*' \
|
||||
-o -path './staging/*' \
|
||||
-o -path './vendor/*' \
|
||||
\) -prune \
|
||||
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sed "s|^\./|${KUBE_GO_PACKAGE}/|" | LC_ALL=C sort -u
|
||||
|
||||
find -L . \
|
||||
-path './_output' -prune \
|
||||
-o -path './vendor/k8s.io/client-go/*' \
|
||||
-o -path './vendor/k8s.io/apiserver/*' \
|
||||
-o -path './test/e2e_node/system/*' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed "s|^\./|${KUBE_GO_PACKAGE}/|" | LC_ALL=C sort -u
|
||||
|
||||
# run tests for client-go
|
||||
find ./staging/src/k8s.io/client-go -name '*_test.go' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
|
||||
|
||||
# run tests for apiserver
|
||||
find ./staging/src/k8s.io/apiserver -name '*_test.go' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
|
||||
|
||||
# run tests for apimachinery
|
||||
find ./staging/src/k8s.io/apimachinery -name '*_test.go' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
|
||||
|
||||
find ./staging/src/k8s.io/kube-aggregator -name '*_test.go' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
|
||||
|
||||
find ./staging/src/k8s.io/apiextensions-apiserver -not \( \
|
||||
\( \
|
||||
-path '*/test/integration/*' \
|
||||
\) -prune \
|
||||
\) -name '*_test.go' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
|
||||
|
||||
find ./staging/src/k8s.io/sample-apiserver -name '*_test.go' \
|
||||
-name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
|
||||
)
|
||||
}
|
||||
|
||||
KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 120s}
|
||||
KUBE_COVER=${KUBE_COVER:-n} # set to 'y' to enable coverage collection
|
||||
KUBE_COVERMODE=${KUBE_COVERMODE:-atomic}
|
||||
# How many 'go test' instances to run simultaneously when running tests in
|
||||
# coverage mode.
|
||||
KUBE_COVERPROCS=${KUBE_COVERPROCS:-4}
|
||||
KUBE_RACE=${KUBE_RACE:-} # use KUBE_RACE="-race" to enable race testing
|
||||
# Set to the goveralls binary path to report coverage results to Coveralls.io.
|
||||
KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
|
||||
# Lists of API Versions of each groups that should be tested, groups are
|
||||
# separated by comma, lists are separated by semicolon. e.g.,
|
||||
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
|
||||
# FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go)
|
||||
# ONLY the last version is tested in each group.
|
||||
ALL_VERSIONS_CSV=$(IFS=',';echo "${KUBE_AVAILABLE_GROUP_VERSIONS[*]// /,}";IFS=$)
|
||||
KUBE_TEST_API_VERSIONS="${KUBE_TEST_API_VERSIONS:-${ALL_VERSIONS_CSV}}"
|
||||
# once we have multiple group supports
|
||||
# Create a junit-style XML test report in this directory if set.
|
||||
KUBE_JUNIT_REPORT_DIR=${KUBE_JUNIT_REPORT_DIR:-}
|
||||
# Set to 'y' to keep the verbose stdout from tests when KUBE_JUNIT_REPORT_DIR is
|
||||
# set.
|
||||
KUBE_KEEP_VERBOSE_TEST_OUTPUT=${KUBE_KEEP_VERBOSE_TEST_OUTPUT:-n}
|
||||
|
||||
kube::test::usage() {
|
||||
kube::log::usage_from_stdin <<EOF
|
||||
usage: $0 [OPTIONS] [TARGETS]
|
||||
|
||||
OPTIONS:
|
||||
-p <number> : number of parallel workers, must be >= 1
|
||||
EOF
|
||||
}
|
||||
|
||||
isnum() {
|
||||
[[ "$1" =~ ^[0-9]+$ ]]
|
||||
}
|
||||
|
||||
PARALLEL="${PARALLEL:-1}"
|
||||
while getopts "hp:i:" opt ; do
|
||||
case $opt in
|
||||
h)
|
||||
kube::test::usage
|
||||
exit 0
|
||||
;;
|
||||
p)
|
||||
PARALLEL="$OPTARG"
|
||||
if ! isnum "${PARALLEL}" || [[ "${PARALLEL}" -le 0 ]]; then
|
||||
kube::log::usage "'$0': argument to -p must be numeric and greater than 0"
|
||||
kube::test::usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
i)
|
||||
kube::log::usage "'$0': use GOFLAGS='-count <num-iterations>'"
|
||||
kube::test::usage
|
||||
exit 1
|
||||
;;
|
||||
?)
|
||||
kube::test::usage
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
kube::log::usage "Option -$OPTARG <value>"
|
||||
kube::test::usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# Use eval to preserve embedded quoted strings.
|
||||
eval "goflags=(${GOFLAGS:-})"
|
||||
eval "testargs=(${KUBE_TEST_ARGS:-})"
|
||||
|
||||
# Used to filter verbose test output.
|
||||
go_test_grep_pattern=".*"
|
||||
|
||||
# The go-junit-report tool needs full test case information to produce a
|
||||
# meaningful report.
|
||||
if [[ -n "${KUBE_JUNIT_REPORT_DIR}" ]] ; then
|
||||
goflags+=(-v)
|
||||
# Show only summary lines by matching lines like "status package/test"
|
||||
go_test_grep_pattern="^[^[:space:]]\+[[:space:]]\+[^[:space:]]\+/[^[[:space:]]\+"
|
||||
fi
|
||||
|
||||
# Filter out arguments that start with "-" and move them to goflags.
|
||||
testcases=()
|
||||
for arg; do
|
||||
if [[ "${arg}" == -* ]]; then
|
||||
goflags+=("${arg}")
|
||||
else
|
||||
testcases+=("${arg}")
|
||||
fi
|
||||
done
|
||||
if [[ ${#testcases[@]} -eq 0 ]]; then
|
||||
testcases=($(kube::test::find_dirs))
|
||||
fi
|
||||
set -- "${testcases[@]+${testcases[@]}}"
|
||||
|
||||
junitFilenamePrefix() {
|
||||
if [[ -z "${KUBE_JUNIT_REPORT_DIR}" ]]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
mkdir -p "${KUBE_JUNIT_REPORT_DIR}"
|
||||
# This filename isn't parsed by anything, and we must avoid
|
||||
# exceeding 255 character filename limit. KUBE_TEST_API
|
||||
# barely fits there and in coverage mode test names are
|
||||
# appended to generated file names, easily exceeding
|
||||
# 255 chars in length. So let's just use a sha1 hash of it.
|
||||
local KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"| ${SHA1SUM} |awk '{print $1}')"
|
||||
echo "${KUBE_JUNIT_REPORT_DIR}/junit_${KUBE_TEST_API_HASH}_$(kube::util::sortable_date)"
|
||||
}
|
||||
|
||||
verifyAndSuggestPackagePath() {
|
||||
local specified_package_path="$1"
|
||||
local alternative_package_path="$2"
|
||||
local original_package_path="$3"
|
||||
local suggestion_package_path="$4"
|
||||
|
||||
if ! [ -d "$specified_package_path" ]; then
|
||||
# Because k8s sets a localized $GOPATH for testing, seeing the actual
|
||||
# directory can be confusing. Instead, just show $GOPATH if it exists in the
|
||||
# $specified_package_path.
|
||||
local printable_package_path=$(echo "$specified_package_path" | sed "s|$GOPATH|\$GOPATH|")
|
||||
kube::log::error "specified test path '$printable_package_path' does not exist"
|
||||
|
||||
if [ -d "$alternative_package_path" ]; then
|
||||
kube::log::info "try changing \"$original_package_path\" to \"$suggestion_package_path\""
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
verifyPathsToPackagesUnderTest() {
|
||||
local packages_under_test=($@)
|
||||
|
||||
for package_path in "${packages_under_test[@]}"; do
|
||||
local local_package_path="$package_path"
|
||||
local go_package_path="$GOPATH/src/$package_path"
|
||||
|
||||
if [[ "${package_path:0:2}" == "./" ]] ; then
|
||||
verifyAndSuggestPackagePath "$local_package_path" "$go_package_path" "$package_path" "${package_path:2}"
|
||||
else
|
||||
verifyAndSuggestPackagePath "$go_package_path" "$local_package_path" "$package_path" "./$package_path"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
produceJUnitXMLReport() {
|
||||
local -r junit_filename_prefix=$1
|
||||
if [[ -z "${junit_filename_prefix}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local test_stdout_filenames
|
||||
local junit_xml_filename
|
||||
test_stdout_filenames=$(ls ${junit_filename_prefix}*.stdout)
|
||||
junit_xml_filename="${junit_filename_prefix}.xml"
|
||||
if ! command -v go-junit-report >/dev/null 2>&1; then
|
||||
kube::log::error "go-junit-report not found; please install with " \
|
||||
"go get -u github.com/jstemmer/go-junit-report"
|
||||
return
|
||||
fi
|
||||
cat ${test_stdout_filenames} | go-junit-report > "${junit_xml_filename}"
|
||||
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
|
||||
rm ${test_stdout_filenames}
|
||||
fi
|
||||
kube::log::status "Saved JUnit XML test report to ${junit_xml_filename}"
|
||||
}
|
||||
|
||||
runTests() {
|
||||
local junit_filename_prefix
|
||||
junit_filename_prefix=$(junitFilenamePrefix)
|
||||
|
||||
verifyPathsToPackagesUnderTest "$@"
|
||||
|
||||
# If we're not collecting coverage, run all requested tests with one 'go test'
|
||||
# command, which is much faster.
|
||||
if [[ ! ${KUBE_COVER} =~ ^[yY]$ ]]; then
|
||||
kube::log::status "Running tests without code coverage"
|
||||
go test "${goflags[@]:+${goflags[@]}}" \
|
||||
${KUBE_RACE} ${KUBE_TIMEOUT} "${@}" \
|
||||
"${testargs[@]:+${testargs[@]}}" \
|
||||
| tee ${junit_filename_prefix:+"${junit_filename_prefix}.stdout"} \
|
||||
| grep --binary-files=text "${go_test_grep_pattern}" && rc=$? || rc=$?
|
||||
produceJUnitXMLReport "${junit_filename_prefix}"
|
||||
return ${rc}
|
||||
fi
|
||||
|
||||
# Create coverage report directories.
|
||||
KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"| ${SHA1SUM} |awk '{print $1}')"
|
||||
cover_report_dir="/tmp/k8s_coverage/${KUBE_TEST_API_HASH}/$(kube::util::sortable_date)"
|
||||
cover_profile="coverage.out" # Name for each individual coverage profile
|
||||
kube::log::status "Saving coverage output in '${cover_report_dir}'"
|
||||
mkdir -p "${@+${@/#/${cover_report_dir}/}}"
|
||||
|
||||
# Run all specified tests, collecting coverage results. Go currently doesn't
|
||||
# support collecting coverage across multiple packages at once, so we must issue
|
||||
# separate 'go test' commands for each package and then combine at the end.
|
||||
# To speed things up considerably, we can at least use xargs -P to run multiple
|
||||
# 'go test' commands at once.
|
||||
# To properly parse the test results if generating a JUnit test report, we
|
||||
# must make sure the output from PARALLEL runs is not mixed. To achieve this,
|
||||
# we spawn a subshell for each PARALLEL process, redirecting the output to
|
||||
# separate files.
|
||||
|
||||
# ignore paths:
|
||||
# vendor/k8s.io/code-generator/cmd/generator: is fragile when run under coverage, so ignore it for now.
|
||||
# https://github.com/kubernetes/kubernetes/issues/24967
|
||||
# vendor/k8s.io/client-go/1.4/rest: causes cover internal errors
|
||||
# https://github.com/golang/go/issues/16540
|
||||
cover_ignore_dirs="vendor/k8s.io/code-generator/cmd/generator|vendor/k8s.io/client-go/1.4/rest"
|
||||
for path in $(echo $cover_ignore_dirs | sed 's/|/ /g'); do
|
||||
echo -e "skipped\tk8s.io/kubernetes/$path"
|
||||
done
|
||||
|
||||
printf "%s\n" "${@}" \
|
||||
| grep -Ev $cover_ignore_dirs \
|
||||
| xargs -I{} -n 1 -P ${KUBE_COVERPROCS} \
|
||||
bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \
|
||||
go test ${goflags[@]:+${goflags[@]}} \
|
||||
${KUBE_RACE} \
|
||||
${KUBE_TIMEOUT} \
|
||||
-cover -covermode=\"${KUBE_COVERMODE}\" \
|
||||
-coverprofile=\"${cover_report_dir}/\${_pkg}/${cover_profile}\" \
|
||||
\"\${_pkg}\" \
|
||||
${testargs[@]:+${testargs[@]}} \
|
||||
| tee ${junit_filename_prefix:+\"${junit_filename_prefix}-\$_pkg_out.stdout\"} \
|
||||
| grep \"${go_test_grep_pattern}\"" \
|
||||
{} \
|
||||
&& test_result=$? || test_result=$?
|
||||
|
||||
produceJUnitXMLReport "${junit_filename_prefix}"
|
||||
|
||||
COMBINED_COVER_PROFILE="${cover_report_dir}/combined-coverage.out"
|
||||
{
|
||||
# The combined coverage profile needs to start with a line indicating which
|
||||
# coverage mode was used (set, count, or atomic). This line is included in
|
||||
# each of the coverage profiles generated when running 'go test -cover', but
|
||||
# we strip these lines out when combining so that there's only one.
|
||||
echo "mode: ${KUBE_COVERMODE}"
|
||||
|
||||
# Include all coverage reach data in the combined profile, but exclude the
|
||||
# 'mode' lines, as there should be only one.
|
||||
for x in `find "${cover_report_dir}" -name "${cover_profile}"`; do
|
||||
cat $x | grep -h -v "^mode:" || true
|
||||
done
|
||||
} >"${COMBINED_COVER_PROFILE}"
|
||||
|
||||
coverage_html_file="${cover_report_dir}/combined-coverage.html"
|
||||
go tool cover -html="${COMBINED_COVER_PROFILE}" -o="${coverage_html_file}"
|
||||
kube::log::status "Combined coverage report: ${coverage_html_file}"
|
||||
|
||||
return ${test_result}
|
||||
}
|
||||
|
||||
reportCoverageToCoveralls() {
|
||||
if [[ ${KUBE_COVER} =~ ^[yY]$ ]] && [[ -x "${KUBE_GOVERALLS_BIN}" ]]; then
|
||||
kube::log::status "Reporting coverage results to Coveralls for service ${CI_NAME:-}"
|
||||
${KUBE_GOVERALLS_BIN} -coverprofile="${COMBINED_COVER_PROFILE}" \
|
||||
${CI_NAME:+"-service=${CI_NAME}"} \
|
||||
${COVERALLS_REPO_TOKEN:+"-repotoken=${COVERALLS_REPO_TOKEN}"} \
|
||||
|| true
|
||||
fi
|
||||
}
|
||||
|
||||
checkFDs() {
|
||||
# several unittests panic when httptest cannot open more sockets
|
||||
# due to the low default files limit on OS X. Warn about low limit.
|
||||
local fileslimit="$(ulimit -n)"
|
||||
if [[ $fileslimit -lt 1000 ]]; then
|
||||
echo "WARNING: ulimit -n (files) should be at least 1000, is $fileslimit, may cause test failure";
|
||||
fi
|
||||
}
|
||||
|
||||
checkFDs
|
||||
|
||||
|
||||
# Convert the CSVs to arrays.
|
||||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
||||
apiVersionsCount=${#apiVersions[@]}
|
||||
for (( i=0; i<${apiVersionsCount}; i++ )); do
|
||||
apiVersion=${apiVersions[i]}
|
||||
echo "Running tests for APIVersion: $apiVersion"
|
||||
# KUBE_TEST_API sets the version of each group to be tested.
|
||||
KUBE_TEST_API="${apiVersion}" runTests "$@"
|
||||
done
|
||||
|
||||
# We might run the tests for multiple versions, but we want to report only
|
||||
# one of them to coveralls. Here we report coverage from the last run.
|
||||
reportCoverageToCoveralls
|
84
vendor/k8s.io/kubernetes/hack/make-rules/update.sh
generated
vendored
Executable file
84
vendor/k8s.io/kubernetes/hack/make-rules/update.sh
generated
vendored
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# A single script that runs a predefined set of update-* scripts, as they often go together.
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
# If called directly, exit.
|
||||
if [[ "${CALLED_FROM_MAIN_MAKEFILE:-""}" == "" ]]; then
|
||||
echo "ERROR: $0 should not be run directly." >&2
|
||||
echo >&2
|
||||
echo "Please run this command using \"make update\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SILENT=${SILENT:-true}
|
||||
ALL=${FORCE_ALL:-false}
|
||||
V=""
|
||||
if [[ "${SILENT}" != "true" ]]; then
|
||||
V="-v"
|
||||
fi
|
||||
|
||||
trap 'exit 1' SIGINT
|
||||
|
||||
if ${SILENT} ; then
|
||||
echo "Running in silent mode, run with SILENT=false if you want to see script logs."
|
||||
fi
|
||||
|
||||
if ! ${ALL} ; then
|
||||
echo "Running in short-circuit mode; run with FORCE_ALL=true to force all scripts to run."
|
||||
fi
|
||||
|
||||
"${KUBE_ROOT}/hack/godep-restore.sh" ${V}
|
||||
|
||||
BASH_TARGETS="
|
||||
update-generated-protobuf
|
||||
update-codegen
|
||||
update-generated-runtime
|
||||
update-generated-device-plugin
|
||||
update-generated-docs
|
||||
update-generated-swagger-docs
|
||||
update-swagger-spec
|
||||
update-openapi-spec
|
||||
update-api-reference-docs
|
||||
update-staging-godeps
|
||||
update-bazel"
|
||||
|
||||
for t in ${BASH_TARGETS}; do
|
||||
echo -e "${color_yellow}Running $t${color_norm}"
|
||||
if ${SILENT} ; then
|
||||
if ! bash "${KUBE_ROOT}/hack/$t.sh" 1> /dev/null; then
|
||||
echo -e "${color_red}Running $t FAILED${color_norm}"
|
||||
if ! ${ALL}; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if ! bash "${KUBE_ROOT}/hack/$t.sh"; then
|
||||
echo -e "${color_red}Running $t FAILED${color_norm}"
|
||||
if ! ${ALL}; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "${color_green}Update scripts completed successfully${color_norm}"
|
171
vendor/k8s.io/kubernetes/hack/make-rules/verify.sh
generated
vendored
Executable file
171
vendor/k8s.io/kubernetes/hack/make-rules/verify.sh
generated
vendored
Executable file
@@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# 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/util.sh"
|
||||
|
||||
# include shell2junit library
|
||||
source "${KUBE_ROOT}/third_party/forked/shell2junit/sh2ju.sh"
|
||||
|
||||
# Excluded check patterns are always skipped.
|
||||
EXCLUDED_PATTERNS=(
|
||||
"verify-all.sh" # this script calls the make rule and would cause a loop
|
||||
"verify-linkcheck.sh" # runs in separate Jenkins job once per day due to high network usage
|
||||
"verify-test-owners.sh" # TODO(rmmh): figure out how to avoid endless conflicts
|
||||
"verify-*-dockerized.sh" # Don't run any scripts that intended to be run dockerized
|
||||
"verify-typecheck.sh" # runs in separate typecheck job
|
||||
)
|
||||
|
||||
# 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-generated-files-remake"
|
||||
"verify-godep-licenses.sh"
|
||||
"verify-gofmt.sh"
|
||||
"verify-imports.sh"
|
||||
"verify-pkg-names.sh"
|
||||
"verify-readonly-packages.sh"
|
||||
"verify-spelling.sh"
|
||||
"verify-staging-client-go.sh"
|
||||
"verify-test-images.sh"
|
||||
"verify-test-owners.sh"
|
||||
)
|
||||
|
||||
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 {
|
||||
for e in ${EXCLUDED_CHECKS[@]}; do
|
||||
if [[ $1 -ef "$e" ]]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function is-quick {
|
||||
for e in ${QUICK_CHECKS[@]}; do
|
||||
if [[ $1 -ef "$e" ]]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function is-explicitly-chosen {
|
||||
local name="${1#verify-}"
|
||||
name="${name%.*}"
|
||||
for e in ${WHAT}; do
|
||||
if [[ $e == "$name" ]]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function run-cmd {
|
||||
local filename="${2##*/verify-}"
|
||||
local testname="${filename%%.*}"
|
||||
local output="${KUBE_JUNIT_REPORT_DIR:-/tmp/junit-results}"
|
||||
local tr
|
||||
|
||||
if ${SILENT}; then
|
||||
juLog -output="${output}" -class="verify" -name="${testname}" "$@" &> /dev/null
|
||||
tr=$?
|
||||
else
|
||||
juLog -output="${output}" -class="verify" -name="${testname}" "$@"
|
||||
tr=$?
|
||||
fi
|
||||
return ${tr}
|
||||
}
|
||||
|
||||
# Collect Failed tests in this Array , initialize it to nil
|
||||
FAILED_TESTS=()
|
||||
|
||||
function print-failed-tests {
|
||||
echo -e "========================"
|
||||
echo -e "${color_red}FAILED TESTS${color_norm}"
|
||||
echo -e "========================"
|
||||
for t in ${FAILED_TESTS[@]}; do
|
||||
echo -e "${color_red}${t}${color_norm}"
|
||||
done
|
||||
}
|
||||
|
||||
function run-checks {
|
||||
local -r pattern=$1
|
||||
local -r runner=$2
|
||||
|
||||
local t
|
||||
for t in $(ls ${pattern})
|
||||
do
|
||||
local check_name="$(basename "${t}")"
|
||||
if [[ ! -z ${WHAT:-} ]]; then
|
||||
if ! is-explicitly-chosen "${check_name}"; then
|
||||
continue
|
||||
fi
|
||||
else
|
||||
if is-excluded "${t}" ; then
|
||||
echo "Skipping ${check_name}"
|
||||
continue
|
||||
fi
|
||||
if ${QUICK} && ! is-quick "${t}" ; then
|
||||
echo "Skipping ${check_name} in quick mode"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
echo -e "Verifying ${check_name}"
|
||||
local start=$(date +%s)
|
||||
run-cmd "${runner}" "${t}" && tr=$? || tr=$?
|
||||
local elapsed=$(($(date +%s) - ${start}))
|
||||
if [[ ${tr} -eq 0 ]]; then
|
||||
echo -e "${color_green}SUCCESS${color_norm} ${check_name}\t${elapsed}s"
|
||||
else
|
||||
echo -e "${color_red}FAILED${color_norm} ${check_name}\t${elapsed}s"
|
||||
ret=1
|
||||
FAILED_TESTS+=(${t})
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
SILENT=${SILENT:-false}
|
||||
QUICK=${QUICK:-false}
|
||||
|
||||
if ${SILENT} ; then
|
||||
echo "Running in silent mode, run with SILENT=false if you want to see script logs."
|
||||
fi
|
||||
|
||||
if ${QUICK} ; then
|
||||
echo "Running in quick mode (QUICK=true). Only fast checks will run."
|
||||
fi
|
||||
|
||||
ret=0
|
||||
run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
|
||||
run-checks "${KUBE_ROOT}/hack/verify-*.py" python
|
||||
|
||||
if [[ ${ret} -eq 1 ]]; then
|
||||
print-failed-tests
|
||||
fi
|
||||
exit ${ret}
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
56
vendor/k8s.io/kubernetes/hack/make-rules/vet.sh
generated
vendored
Executable file
56
vendor/k8s.io/kubernetes/hack/make-rules/vet.sh
generated
vendored
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# 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"
|
||||
|
||||
cd "${KUBE_ROOT}"
|
||||
|
||||
# If called directly, exit.
|
||||
if [[ "${CALLED_FROM_MAIN_MAKEFILE:-""}" == "" ]]; then
|
||||
echo "ERROR: $0 should not be run directly." >&2
|
||||
echo >&2
|
||||
echo "Please run this command using \"make vet\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This is required before we run govet for the results to be correct.
|
||||
# See https://github.com/golang/go/issues/16086 for details.
|
||||
go install ./cmd/...
|
||||
|
||||
# Use eval to preserve embedded quoted strings.
|
||||
eval "goflags=(${GOFLAGS:-})"
|
||||
|
||||
# Filter out arguments that start with "-" and move them to goflags.
|
||||
targets=()
|
||||
for arg; do
|
||||
if [[ "${arg}" == -* ]]; then
|
||||
goflags+=("${arg}")
|
||||
else
|
||||
targets+=("${arg}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#targets[@]} -eq 0 ]]; then
|
||||
# Do not run on third_party directories or generated client code.
|
||||
targets=$(go list -e ./... | egrep -v "/(third_party|vendor|staging|clientset_generated)/")
|
||||
fi
|
||||
|
||||
go vet "${goflags[@]:+${goflags[@]}}" ${targets[@]}
|
Reference in New Issue
Block a user