-
Notifications
You must be signed in to change notification settings - Fork 49
ci: replace unverified test binary downloads with setup-envtest #488
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
base: master
Are you sure you want to change the base?
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -57,28 +57,14 @@ jobs: | |||||
| - name: Check out code into the Go module directory | ||||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||
|
|
||||||
| - name: Install kubebuilder | ||||||
| - name: Install envtest binaries | ||||||
| run: | | ||||||
| curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_$(go env GOOS)_$(go env GOARCH)" && \ | ||||||
| curl -L -O "https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-server-$(go env GOOS)-$(go env GOARCH).tar.gz" && \ | ||||||
| curl -L -O "https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-client-$(go env GOOS)-$(go env GOARCH).tar.gz" && \ | ||||||
| curl -L -O "https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH).tar.gz" && \ | ||||||
| tar -zxvf kubernetes-server-$(go env GOOS)-$(go env GOARCH).tar.gz && \ | ||||||
| tar -zxvf kubernetes-client-$(go env GOOS)-$(go env GOARCH).tar.gz && \ | ||||||
| tar -zxvf etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH).tar.gz && \ | ||||||
| chmod +x kubebuilder_$(go env GOOS)_$(go env GOARCH) && \ | ||||||
| chmod +x kubernetes/server/bin/kube-apiserver && \ | ||||||
| chmod +x kubernetes/client/bin/kubectl && \ | ||||||
| chmod +x etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH)/etcd && \ | ||||||
| sudo mkdir -p /usr/local/kubebuilder/bin && \ | ||||||
| sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/kubebuilder/bin/kubebuilder && \ | ||||||
| sudo mv kubernetes/server/bin/kube-apiserver /usr/local/kubebuilder/bin/kube-apiserver && \ | ||||||
| sudo mv kubernetes/server/bin/kubectl /usr/local/kubebuilder/bin/kubectl && \ | ||||||
| sudo mv etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH)/etcd /usr/local/kubebuilder/bin/etcd | ||||||
| go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||||||
| mkdir -p "${HOME}/kubebuilder/bin" | ||||||
| "$HOME/go/bin/setup-envtest" use "${KUBERNETES_VERSION}" --bin-dir "${HOME}/kubebuilder/bin" -p path | ||||||
|
||||||
| "$HOME/go/bin/setup-envtest" use "${KUBERNETES_VERSION}" --bin-dir "${HOME}/kubebuilder/bin" -p path | |
| "$(go env GOPATH)/bin/setup-envtest" use "${KUBERNETES_VERSION}" --bin-dir "${HOME}/kubebuilder/bin" -p path |
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.
+1
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.
Export setup-envtest output path as KUBEBUILDER_ASSETS
setup-envtest use ... -p path prints the version-specific directory that actually contains kube-apiserver, etcd, and kubectl (the tool’s README explicitly says to use -p path to get the directory). This step discards that output and sets KUBEBUILDER_ASSETS to ${HOME}/kubebuilder/bin, which is only the store root; envtest then resolves binaries as ${KUBEBUILDER_ASSETS}/<name> and will not search nested k8s/<version-platform>/ folders, so the make test job will fail when starting envtest.
Useful? React with 👍 / 👎.
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.
go install ...@latestmakes the workflow non-reproducible and can unexpectedly change behavior (or break) when a new setup-envtest release is published. Pin setup-envtest to a specific version (or commit) so CI runs are deterministic and easier to audit.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.
I agree here - it should not be latest.