Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 47 additions & 16 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,53 @@ jobs:

- name: Install kubebuilder
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
set -euo pipefail

os="$(go env GOOS)"
arch="$(go env GOARCH)"

curl --fail --show-error --silent --location --remote-name \
"https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_${os}_${arch}"
curl --fail --show-error --silent --location --remote-name \
"https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/checksums.txt"
grep " kubebuilder_${os}_${arch}$" checksums.txt | sha256sum --check --status

curl --fail --show-error --silent --location --remote-name \
"https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-server-${os}-${arch}.tar.gz"
curl --fail --show-error --silent --location --remote-name \
"https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-server-${os}-${arch}.tar.gz.sha256"
sha256sum --check --status <<EOF
$(cat kubernetes-server-${os}-${arch}.tar.gz.sha256) kubernetes-server-${os}-${arch}.tar.gz
EOF
Comment on lines +78 to +79

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Re-indent heredoc body to keep workflow YAML valid

The heredoc payload is flush-left inside the run: | block, so YAML parsing treats $(cat kubernetes-server-...) as a new top-level key instead of script content. In my local check (ruby/Psych), this file fails to parse with could not find expected ':' at this line, which means GitHub Actions cannot load this workflow as written and the Unit test job will not run. The same indentation issue appears again in the second heredoc block.

Useful? React with 👍 / 👎.


curl --fail --show-error --silent --location --remote-name \
"https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-client-${os}-${arch}.tar.gz"
curl --fail --show-error --silent --location --remote-name \
"https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-client-${os}-${arch}.tar.gz.sha256"
sha256sum --check --status <<EOF
$(cat kubernetes-client-${os}-${arch}.tar.gz.sha256) kubernetes-client-${os}-${arch}.tar.gz
EOF

curl --fail --show-error --silent --location --remote-name \
"https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
curl --fail --show-error --silent --location --remote-name \
"https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/SHA256SUMS"
grep " etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz$" SHA256SUMS | sha256sum --check --status

tar -zxvf "kubernetes-server-${os}-${arch}.tar.gz"
tar -zxvf "kubernetes-client-${os}-${arch}.tar.gz"
tar -zxvf "etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"

chmod +x "kubebuilder_${os}_${arch}"
chmod +x kubernetes/server/bin/kube-apiserver
chmod +x kubernetes/client/bin/kubectl
Comment on lines +82 to +101

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow downloads and verifies the Kubernetes client tarball, but the only subsequent reference is a chmod on kubernetes/client/bin/kubectl (the installed kubectl comes from the server tree). If the client tarball isn't needed, dropping its download/verify/extract will reduce CI time and surface area; otherwise, install kubectl from the client tarball consistently.

This issue also appears on line 99 of the same file.

Suggested change
"https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-client-${os}-${arch}.tar.gz"
curl --fail --show-error --silent --location --remote-name \
"https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-client-${os}-${arch}.tar.gz.sha256"
sha256sum --check --status <<EOF
$(cat kubernetes-client-${os}-${arch}.tar.gz.sha256) kubernetes-client-${os}-${arch}.tar.gz
EOF
curl --fail --show-error --silent --location --remote-name \
"https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
curl --fail --show-error --silent --location --remote-name \
"https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/SHA256SUMS"
grep " etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz$" SHA256SUMS | sha256sum --check --status
tar -zxvf "kubernetes-server-${os}-${arch}.tar.gz"
tar -zxvf "kubernetes-client-${os}-${arch}.tar.gz"
tar -zxvf "etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
chmod +x "kubebuilder_${os}_${arch}"
chmod +x kubernetes/server/bin/kube-apiserver
chmod +x kubernetes/client/bin/kubectl
"https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
curl --fail --show-error --silent --location --remote-name \
"https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/SHA256SUMS"
grep " etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz$" SHA256SUMS | sha256sum --check --status
tar -zxvf "kubernetes-server-${os}-${arch}.tar.gz"
tar -zxvf "etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
chmod +x "kubebuilder_${os}_${arch}"
chmod +x kubernetes/server/bin/kube-apiserver

Copilot uses AI. Check for mistakes.
chmod +x "etcd-v${ETCD_VERSION}-${os}-${arch}/etcd"

sudo mkdir -p /usr/local/kubebuilder/bin
sudo mv "kubebuilder_${os}_${arch}" /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}-${os}-${arch}/etcd" /usr/local/kubebuilder/bin/etcd
env:
KUBEBUILDER_VERSION: 3.9.0
KUBERNETES_VERSION: 1.26.1
Expand Down
Loading