-
Notifications
You must be signed in to change notification settings - Fork 108
chore: Improve performance of make verify #1382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,36 +4,76 @@ set -euo pipefail | |
| K8S_VERSION="${K8S_VERSION:="1.29.x"}" | ||
| KUBEBUILDER_ASSETS="/usr/local/kubebuilder/bin" | ||
|
|
||
| # Default SKIP_INSTALLED to false if not set | ||
| SKIP_INSTALLED="${SKIP_INSTALLED:=false}" | ||
|
|
||
| if [ "$SKIP_INSTALLED" == true ]; then | ||
| echo "[INF] Skipping tools already installed." | ||
| fi | ||
|
|
||
| # This is where go install will put things | ||
| TOOL_DEST="$(go env GOPATH)/bin" | ||
|
|
||
| main() { | ||
| tools | ||
| kubebuilder | ||
| gettrivy | ||
| } | ||
|
|
||
| # should-skip is a helper function to determine if installation of a tool should be skipped | ||
| # $1 is the expected command | ||
| should-skip() { | ||
| if [ "$SKIP_INSTALLED" == true ] && [ -f "$TOOL_DEST/$1" ]; then | ||
|
||
| # We can skip installation | ||
| return 0 | ||
| fi | ||
|
|
||
| # Installation is needed | ||
| return 1 | ||
| } | ||
theunrepentantgeek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # go-install is a helper function to install go tools | ||
| # $1 is the expected command | ||
| # $2 is the go install path | ||
| go-install() { | ||
| # Check to see if we need to install | ||
| if should-skip "$1"; then | ||
| # Silently skip, to avoid console debris | ||
| # echo "[INF] $1 is already installed, skipping." | ||
| return | ||
| fi | ||
|
|
||
| echo "[INF] Installing $1" | ||
| go install "$2" | ||
| } | ||
|
|
||
| tools() { | ||
| go install github.com/google/go-licenses@v1.6.0 | ||
| go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0 | ||
| go install github.com/google/ko@v0.17.1 | ||
| go install github.com/mikefarah/yq/v4@v4.45.1 | ||
| go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14.2 | ||
| go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.19.0 | ||
| go install github.com/sigstore/cosign/v2/cmd/cosign@v2.4.1 | ||
| go-install go-licenses github.com/google/go-licenses@v1.6.0 | ||
| go-install ko github.com/google/ko@v0.17.1 | ||
| go-install yq github.com/mikefarah/yq/v4@v4.45.1 | ||
| go-install helm-docs github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14.2 | ||
| go-install controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen@v0.19.0 | ||
| go-install cosign github.com/sigstore/cosign/v2/cmd/cosign@v2.4.1 | ||
| # go install -tags extended github.com/gohugoio/hugo@v0.110.0 | ||
| go install golang.org/x/vuln/cmd/govulncheck@v1.1.4 | ||
| go install github.com/onsi/ginkgo/v2/ginkgo@latest | ||
| go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 | ||
| go install github.com/mattn/goveralls@v0.0.12 | ||
| go install github.com/google/go-containerregistry/cmd/crane@v0.20.2 | ||
| go install github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1 | ||
| go install github.com/Azure/aks-node-viewer/cmd/aks-node-viewer@latest | ||
| go install github.com/google/pprof@latest | ||
| go-install govulncheck golang.org/x/vuln/cmd/govulncheck@v1.1.4 | ||
| go-install ginkgo github.com/onsi/ginkgo/v2/ginkgo@latest | ||
theunrepentantgeek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| go-install actionlint github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 | ||
| go-install goveralls github.com/mattn/goveralls@v0.0.12 | ||
| go-install crane github.com/google/go-containerregistry/cmd/crane@v0.20.2 | ||
| go-install swagger github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1 | ||
| go-install aks-node-viewer github.com/Azure/aks-node-viewer/cmd/aks-node-viewer@latest | ||
| go-install pprof github.com/google/pprof@latest | ||
theunrepentantgeek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if ! echo "$PATH" | grep -q "${GOPATH:-undefined}/bin\|$HOME/go/bin"; then | ||
| echo "Go workspace's \"bin\" directory is not in PATH. Run 'export PATH=\"\$PATH:\${GOPATH:-\$HOME/go}/bin\"'." | ||
| fi | ||
|
|
||
| go-install golangci-lint github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0 | ||
theunrepentantgeek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| } | ||
|
|
||
| kubebuilder() { | ||
| echo "[INF] Setting up kubebuilder binaries for Kubernetes ${K8S_VERSION}" | ||
| sudo mkdir -p "${KUBEBUILDER_ASSETS}" | ||
| sudo chown "${USER}" "${KUBEBUILDER_ASSETS}" | ||
| arch=$(go env GOARCH) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent use of single brackets with double equals operator. The codebase convention uses double brackets
[[with==for string comparisons (see hack/codegen.sh:81, hack/codegen.sh:103, hack/release/common.sh:98, etc.). Consider changing to:if [[ "$SKIP_INSTALLED" == true ]]; then