kubernetes/hack
Tim Hockin 81d932906a
Make golang::binaries_from_targets smarter
and use it from test

Result: `make` works, but `make test` still broken

```
$ make kubectl
+++ [1211 11:15:46] Building go targets for linux/amd64
    ./cmd/kubectl (static)

$ make WHAT=./cmd/kubectl/
+++ [1211 11:15:53] Building go targets for linux/amd64
    ./cmd/kubectl/ (non-static)

$ make WHAT=cmd/kubectl/
+++ [1211 11:16:02] Building go targets for linux/amd64
    ./cmd/kubectl/ (non-static)

$ make WHAT=k8s.io/kubernetes/cmd/kubectl
+++ [1211 11:16:16] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kubectl (static)

$ make WHAT=./staging/src/k8s.io/api
+++ [1211 11:16:31] Building go targets for linux/amd64
    ./staging/src/k8s.io/api (non-static)

$ make WHAT=staging/src/k8s.io/api
+++ [1211 11:16:43] Building go targets for linux/amd64
    ./staging/src/k8s.io/api (non-static)

$ make WHAT=k8s.io/api
+++ [1211 11:16:50] Building go targets for linux/amd64
    k8s.io/api (non-static)
```

```
$ make test WHAT=./cmd/kubectl
+++ [1211 11:17:23] Set GOMAXPROCS automatically to 6
+++ [1211 11:17:23] Running tests without code coverage and with -race
cmd/kubectl/kubectl.go:25:2: cannot find package "k8s.io/client-go/plugin/pkg/client/auth" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/client-go/plugin/pkg/client/auth (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/client-go/plugin/pkg/client/auth (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/client-go/plugin/pkg/client/auth (from $GOPATH)
cmd/kubectl/kubectl.go:20:2: cannot find package "k8s.io/component-base/cli" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/component-base/cli (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/component-base/cli (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/component-base/cli (from $GOPATH)
cmd/kubectl/kubectl.go:21:2: cannot find package "k8s.io/kubectl/pkg/cmd" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/kubectl/pkg/cmd (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubectl/pkg/cmd (from $GOPATH)
cmd/kubectl/kubectl.go:22:2: cannot find package "k8s.io/kubectl/pkg/cmd/util" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/util (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/kubectl/pkg/cmd/util (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubectl/pkg/cmd/util (from $GOPATH)
make: *** [Makefile:191: test] Error 1
```
2024-02-29 00:22:08 -08:00
..
boilerplate boilerplate_test:fix pylint warnings 2024-01-24 11:05:26 +02:00
conformance
e2e-internal
gen-swagger-doc
jenkins
lib Make golang::binaries_from_targets smarter 2024-02-29 00:22:08 -08:00
make-rules Make golang::binaries_from_targets smarter 2024-02-29 00:22:08 -08:00
testdata
tools Generate go.work files 2024-02-29 00:22:06 -08:00
verify-flags
.descriptions_failures
.import-aliases
.spelling_failures
benchmark-go.sh
build-cross.sh
build-go.sh
cherry_pick_pull.sh
dev-build-and-push.sh
dev-build-and-up.sh
dev-push-conformance.sh
e2e-node-test.sh
generate-docs.sh
get-build.sh
ginkgo-e2e.sh
golangci-hints.yaml golangci-lint: add hints for error wrapping 2024-02-13 14:12:04 +01:00
golangci-strict.yaml
golangci.yaml
golangci.yaml.in golangci-lint: add hints for error wrapping 2024-02-13 14:12:04 +01:00
grab-profiles.sh
install-etcd.sh
install-protoc.sh
lint-dependencies.sh
list-feature-tests.sh
local-up-cluster.sh Merge pull request #122612 from mtardy/remove-scdeny 2024-02-12 08:37:13 -08:00
logcheck.conf
module-graph.sh
OWNERS
pin-dependency.sh
print-workspace-status.sh
README.md
run-in-gopath.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
run-prometheus-on-etcd-scrapes.sh
serve-prom-scrapes.sh
test-go.sh
test-integration.sh
unwanted-dependencies.json chore: Cleanup in-tree credential provider azure and cloud provider azure 2024-01-20 15:18:31 +08:00
update-all.sh
update-codegen.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-conformance-yaml.sh
update-generated-api-compatibility-data.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-generated-docs.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-generated-proto-bindings-dockerized.sh
update-generated-protobuf-dockerized.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-generated-stable-metrics.sh
update-go-workspace.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-gofmt.sh
update-golangci-lint-config.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-import-aliases.sh
update-internal-modules.sh
update-kustomize.sh
update-mocks.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-netparse-cve.sh
update-openapi-spec.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-translations.sh
update-vanity-imports.sh chore: adds consistent vanity import to files and provides tooling for verifying and updating them. (#120642) 2024-02-08 04:33:30 -08:00
update-vendor-licenses.sh
update-vendor.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
update-yamlfmt.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-all.sh
verify-api-groups.sh
verify-boilerplate.sh
verify-cli-conventions.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-codegen.sh
verify-conformance-requirements.sh
verify-conformance-yaml.sh
verify-description.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-e2e-suites.sh
verify-e2e-test-ownership.sh
verify-external-dependencies-version.sh
verify-fieldname-docs.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-file-sizes.sh
verify-flags-underscore.py
verify-generated-docs.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-generated-stable-metrics.sh
verify-go-workspace.sh Generate go.work files 2024-02-29 00:22:06 -08:00
verify-gofmt.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-golangci-lint-config.sh
verify-golangci-lint-pr-hints.sh
verify-golangci-lint-pr.sh
verify-golangci-lint.sh
verify-govulncheck.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-import-aliases.sh
verify-import-boss.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-imports.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-internal-modules.sh
verify-licenses.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-mocks.sh
verify-netparse-cve.sh
verify-no-vendor-cycles.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-non-mutating-validation.sh
verify-openapi-docs-urls.sh
verify-openapi-spec.sh Change the build_binaries path to use modules 2024-02-29 00:22:07 -08:00
verify-pkg-names.sh
verify-prerelease-lifecycle-tags.sh
verify-prometheus-imports.sh
verify-publishing-bot.py
verify-readonly-packages.sh
verify-shellcheck.sh Bump shellcheck to 0.9.0 2024-01-26 16:26:40 -08:00
verify-spelling.sh
verify-staging-meta-files.sh
verify-test-code.sh
verify-test-featuregates.sh
verify-test-images.sh
verify-testing-import.sh enable testing import check for kubeadm binary 2024-01-25 19:56:42 +08:00
verify-typecheck-providerless.sh
verify-typecheck.sh Revert "Make verify-typecheck.sh only check valid targets for a platform" 2024-01-22 20:45:25 -08:00
verify-vendor-licenses.sh
verify-vendor.sh
verify-yamlfmt.sh

Kubernetes hack GuideLines

This document describes how you can use the scripts from hack directory and gives a brief introduction and explanation of these scripts.

Overview

The hack directory contains many scripts that ensure continuous development of kubernetes, enhance the robustness of the code, improve development efficiency, etc. The explanations and descriptions of these scripts are helpful for contributors. For details, refer to the following guidelines.

Key scripts

  • verify-all.sh: This script is a vestigial redirection, Please do not add "real" logic. It is equivalent to make verify.
  • update-all.sh: This script is a vestigial redirection, Please do not add "real" logic. The true target of this makerule is hack/make-rules/update.sh.It is equivalent to make update.

Attention

Note that all scripts must be run from the Kubernetes root directory. We should run hack/verify-all.sh before submitting a PR and if anything fails run hack/update-all.sh.