From d798d86981de9ee929231f8e649573d981441ba4 Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Wed, 12 Mar 2025 14:15:32 -0700 Subject: [PATCH 1/3] cleanup CI integration scripts - stop setting ARTIFACTS from WORKSPACE, CI handles setting ARTIFACTS and WORKSPACE isn't used anymore (bazel?) - stop cd-ing GOPATH, CI sets the working dir already and local users won't necessarily have GOPATH - sop clobbering PATH with hardcoded assumptions, source install-etcd.sh instead (which updates PATH) - don't redundantly set KUBE_COVER to the default - pass logging env inline so the command can be pasted locally - set -x so the command is visible - add TODO about needing a wrapper script just to call install-etcd --- hack/jenkins/test-cmd-dockerized.sh | 17 +++---------- hack/jenkins/test-dockerized.sh | 26 +++---------------- hack/jenkins/test-integration-dockerized.sh | 28 +++++---------------- 3 files changed, 14 insertions(+), 57 deletions(-) diff --git a/hack/jenkins/test-cmd-dockerized.sh b/hack/jenkins/test-cmd-dockerized.sh index cc7ed476c6c..07baa4f7a07 100755 --- a/hack/jenkins/test-cmd-dockerized.sh +++ b/hack/jenkins/test-cmd-dockerized.sh @@ -19,20 +19,11 @@ set -o nounset set -o pipefail set -o xtrace -# Runs test-cmd, -# producing JUnit-style XML test -# reports in ${WORKSPACE}/artifacts. This script is intended to be run from -# kubekins-test container with a kubernetes repo mapped in. See -# k8s.io/test-infra/scenarios/kubernetes_verify.py +# Runs test-cmd, intended to be run in prow.k8s.io +set -x; -export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} - -# Set artifacts directory -export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"} - -cd "${GOPATH}/src/k8s.io/kubernetes" - -./hack/install-etcd.sh +# TODO: make test-cmd should handle this automatically +source ./hack/install-etcd.sh make test-cmd diff --git a/hack/jenkins/test-dockerized.sh b/hack/jenkins/test-dockerized.sh index 0bc747cb348..72b6884b30b 100755 --- a/hack/jenkins/test-dockerized.sh +++ b/hack/jenkins/test-dockerized.sh @@ -19,32 +19,14 @@ set -o nounset set -o pipefail set -o xtrace -# Runs test-cmd and test-integration, -# producing JUnit-style XML test -# reports in ${WORKSPACE}/artifacts. This script is intended to be run from -# kubekins-test container with a kubernetes repo mapped in. See -# k8s.io/test-infra/scenarios/kubernetes_verify.py +# Runs test-cmd and test-integration, intended to be run in prow.k8s.io +set -x; -export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} +# TODO: make test-integration should handle this automatically +source ./hack/install-etcd.sh -# Install tools we need -hack_tools_gotoolchain="${GOTOOLCHAIN:-}" -if [ -n "${KUBE_HACK_TOOLS_GOTOOLCHAIN:-}" ]; then - hack_tools_gotoolchain="${KUBE_HACK_TOOLS_GOTOOLCHAIN}"; -fi -GOTOOLCHAIN="${hack_tools_gotoolchain}" go -C "./hack/tools" install gotest.tools/gotestsum - -# Disable coverage report -export KUBE_COVER="n" -# Set artifacts directory -export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"} # Save the verbose stdout as well. export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y export LOG_LEVEL=4 - -cd "${GOPATH}/src/k8s.io/kubernetes" - -./hack/install-etcd.sh - make test-cmd make test-integration diff --git a/hack/jenkins/test-integration-dockerized.sh b/hack/jenkins/test-integration-dockerized.sh index 6b9adff8dfa..ec856abc3bd 100755 --- a/hack/jenkins/test-integration-dockerized.sh +++ b/hack/jenkins/test-integration-dockerized.sh @@ -19,27 +19,11 @@ set -o nounset set -o pipefail set -o xtrace -# Runs test-integration, -# producing JUnit-style XML test -# reports in ${WORKSPACE}/artifacts. This script is intended to be run from -# kubekins-test container with a kubernetes repo mapped in. See -# k8s.io/test-infra/scenarios/kubernetes_verify.py +# Runs test-integration +# This script is intended to be run from prow.k8s.io +set -x; -export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH} +# TODO: make test-integration should handle this automatically +source ./hack/install-etcd.sh -# Install tools we need -go -C "./hack/tools" install gotest.tools/gotestsum - -# Disable coverage report -export KUBE_COVER="n" -# Set artifacts directory -export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"} -# Save the verbose stdout as well. -export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y -export LOG_LEVEL=4 - -cd "${GOPATH}/src/k8s.io/kubernetes" - -./hack/install-etcd.sh - -make test-integration +make test-integration KUBE_KEEP_VERBOSE_TEST_OUTPUT=y LOG_LEVEL=4 From 8898868fea4dd965ffbfc2b39c05b9fce9c14bc0 Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Wed, 12 Mar 2025 14:16:08 -0700 Subject: [PATCH 2/3] install-ectd.sh: brace PATH and suggest user export --- hack/install-etcd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/install-etcd.sh b/hack/install-etcd.sh index fb4bed85364..5acb177babd 100755 --- a/hack/install-etcd.sh +++ b/hack/install-etcd.sh @@ -27,4 +27,4 @@ source "${KUBE_ROOT}/hack/lib/init.sh" FOUND="$(echo "${PATH}" | sed 's/:/\n/g' | grep -q "^${KUBE_ROOT}/third_party/etcd$" || true)" kube::etcd::install -test -n "${FOUND}" || echo " PATH=\"\$PATH:${KUBE_ROOT}/third_party/etcd\"" +test -n "${FOUND}" || echo "export PATH=\"\${PATH}:${KUBE_ROOT}/third_party/etcd\"" From 1ddfc7bdce195cd8d6c80160e809390ce27fded6 Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Wed, 12 Mar 2025 14:31:38 -0700 Subject: [PATCH 3/3] benchmark-dockerized.sh: don't redundantly install gotestsum this is handled centrally by make test which is called by make test-integration which this script calls only make test's implementation actually calls gotestsum, and it also handles installing if needed --- hack/jenkins/benchmark-dockerized.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/hack/jenkins/benchmark-dockerized.sh b/hack/jenkins/benchmark-dockerized.sh index 2adda151df3..a01dee72279 100755 --- a/hack/jenkins/benchmark-dockerized.sh +++ b/hack/jenkins/benchmark-dockerized.sh @@ -48,7 +48,6 @@ if [ -n "${KUBE_HACK_TOOLS_GOTOOLCHAIN:-}" ]; then hack_tools_gotoolchain="${KUBE_HACK_TOOLS_GOTOOLCHAIN}"; fi GOTOOLCHAIN="${hack_tools_gotoolchain}" go -C "${KUBE_ROOT}/hack/tools" install github.com/cespare/prettybench -GOTOOLCHAIN="${hack_tools_gotoolchain}" go -C "${KUBE_ROOT}/hack/tools" install gotest.tools/gotestsum # Disable the Go race detector. export KUBE_RACE=" "