From f7427d07e0643f44f85e90645e221e7e117ee36b Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 8 Jun 2022 08:37:45 +0200 Subject: [PATCH] build: add ginkgo aliases for WHAT The alias for vendor/github.com/onsi/ginkgo/ginkgo ensures that code like https://github.com/chendave/test-infra/blob/30e99cb2a97fdee7bb41316881cfbca91bb600db/experiment/kind-conformance-image-e2e.sh#L110 continues to work. The one without "vendor/" is there just in case that it was used because it also worked. Long term, "ginkgo" is a nicer, version independent alias. It gets used internally to avoid future churn and gets documented also publicly in the Makefile help. The caveat is that there's no guarantee that a future v3 CLI will be compatible with current invocations. But the most common usage is through hack/ginkgo-e2e.sh, which can deal with such differences. --- build/root/Makefile | 2 ++ hack/lib/golang.sh | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/root/Makefile b/build/root/Makefile index c6c39e0b005..c99ef99b54a 100644 --- a/build/root/Makefile +++ b/build/root/Makefile @@ -70,6 +70,8 @@ define ALL_HELP_INFO # WHAT: Directory names to build. If any of these directories has a 'main' # package, the build will produce executable files under $(OUT_DIR)/bin. # If not specified, "everything" will be built. +# "vendor//" is accepted as alias for "/". +# "ginkgo" is an alias for the ginkgo CLI. # GOFLAGS: Extra flags to pass to 'go' when building. # GOLDFLAGS: Extra linking flags passed to 'go' when building. # GOGCFLAGS: Additional go compile flags passed to 'go' when building. diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 52a692a852a..b3713e31570 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -111,7 +111,7 @@ readonly KUBE_SERVER_IMAGE_BINARIES=("${KUBE_SERVER_IMAGE_TARGETS[@]##*/}") kube::golang::conformance_image_targets() { # NOTE: this contains cmd targets for kube::release::build_conformance_image local targets=( - github.com/onsi/ginkgo/v2/ginkgo + ginkgo test/e2e/e2e.test test/conformance/image/go-runner cmd/kubectl @@ -274,7 +274,7 @@ kube::golang::test_targets() { cmd/genyaml cmd/genswaggertypedocs cmd/linkcheck - github.com/onsi/ginkgo/v2/ginkgo + ginkgo test/e2e/e2e.test test/conformance/image/go-runner ) @@ -301,7 +301,7 @@ readonly KUBE_TEST_PORTABLE=( kube::golang::server_test_targets() { local targets=( cmd/kubemark - github.com/onsi/ginkgo/v2/ginkgo + ginkgo ) if [[ "${OSTYPE:-}" == "linux"* ]]; then @@ -382,7 +382,14 @@ kube::golang::is_statically_linked_library() { kube::golang::binaries_from_targets() { local target for target; do - if [[ "${target}" =~ ^([[:alnum:]]+".")+[[:alnum:]]+"/" ]]; then + if [ "${target}" = "ginkgo" ] || + [ "${target}" = "github.com/onsi/ginkgo/ginkgo" ] || + [ "${target}" = "vendor/github.com/onsi/ginkgo/ginkgo" ]; then + # Aliases that build the ginkgo CLI for hack/ginkgo-e2e.sh. + # "ginkgo" is the one that is documented in the Makefile. The others + # are for backwards compatibility. + echo "github.com/onsi/ginkgo/v2/ginkgo" + elif [[ "${target}" =~ ^([[:alnum:]]+".")+[[:alnum:]]+"/" ]]; then # If the target starts with what looks like a domain name, assume it has a # fully-qualified package name rather than one that needs the Kubernetes # package prepended.