-
Notifications
You must be signed in to change notification settings - Fork 979
/
toolchain.sh
executable file
·51 lines (44 loc) · 1.93 KB
/
toolchain.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -euo pipefail
K8S_VERSION="${K8S_VERSION:="1.29.x"}"
KUBEBUILDER_ASSETS="/usr/local/kubebuilder/bin"
main() {
tools
kubebuilder
}
tools() {
go install github.com/google/go-licenses@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/google/ko@latest
go install github.com/mikefarah/yq/v4@latest
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go install sigs.k8s.io/controller-tools/cmd/controller-gen@latest
go install github.com/sigstore/cosign/v2/cmd/cosign@latest
go install -tags extended github.com/gohugoio/[email protected]
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/onsi/ginkgo/v2/ginkgo@latest
go install github.com/rhysd/actionlint/cmd/actionlint@latest
go install github.com/mattn/goveralls@latest
go install github.com/google/go-containerregistry/cmd/crane@latest
go install oras.land/oras/cmd/oras@latest
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
}
kubebuilder() {
sudo mkdir -p ${KUBEBUILDER_ASSETS}
sudo chown "${USER}" ${KUBEBUILDER_ASSETS}
arch=$(go env GOARCH)
ln -sf "$(setup-envtest use -p path "${K8S_VERSION}" --arch="${arch}" --bin-dir="${KUBEBUILDER_ASSETS}")"/* ${KUBEBUILDER_ASSETS}
find $KUBEBUILDER_ASSETS
# Install latest binaries for 1.25.x (contains CEL fix)
if [[ "${K8S_VERSION}" = "1.25.x" ]] && [[ "$OSTYPE" == "linux"* ]]; then
for binary in 'kube-apiserver' 'kubectl'; do
rm $KUBEBUILDER_ASSETS/$binary
wget -P $KUBEBUILDER_ASSETS dl.k8s.io/v1.25.16/bin/linux/${arch}/${binary}
chmod +x $KUBEBUILDER_ASSETS/$binary
done
fi
}
main "$@"