Skip to content

Commit

Permalink
ci: remove kubebuilder dependency (#2524)
Browse files Browse the repository at this point in the history
* remove kubebuilder dependency

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

* remove unused package

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

* pin setup-envtest

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

* use .tmp/bin

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
  • Loading branch information
sozercan committed Jan 21, 2023
1 parent 73611cc commit f33c367
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 37 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
issue_comment:
types: [created]

jobs:
jobs:
benchmark:
name: "Benchmark"
if: github.event.issue.pull_request && github.event.comment.body == '/benchmark'
Expand All @@ -14,19 +14,11 @@ jobs:
pull-requests: write
steps:
- uses: izhangzhihao/delete-comment@98aa1ea5c6304048edf951c20b3114e03c785c79
with:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_user_name: github-actions[bot]
issue_number: ${{ github.event.issue.number }}

- name: install kubebuilder
run: |
curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz" &&\
tar -zxvf kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz &&\
sudo mv kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64 /usr/local/kubebuilder
env:
KUBEBUILDER_VERSION: 2.3.1

- name: Update status
uses: peter-evans/create-or-update-comment@v2
with:
Expand All @@ -41,7 +33,7 @@ jobs:

- name: Run benchmarks on base ref
run: make benchmark-test BENCHMARK_FILE_NAME="../base_benchmarks.txt"

- name: Check out code into the Go module directory
uses: actions/checkout@v3

Expand All @@ -66,6 +58,6 @@ jobs:
issue-number: ${{ github.event.issue.number }}
body: |
This PR compares its performance to the latest released version. If it performs significantly lower, consider optimizing your changes to improve the performance.
```
```
${{ steps.get-comment-body.outputs.msg }}
```
8 changes: 1 addition & 7 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Unit test
run: |
curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz" &&\
tar -zxvf kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz &&\
sudo mv kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64 /usr/local/kubebuilder
make native-test
env:
KUBEBUILDER_VERSION: 2.3.1
run: make native-test

- name: Codecov Upload
uses: codecov/codecov-action@v3
Expand Down
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ VERSION := v3.12.0-beta.0
KIND_VERSION ?= 0.17.0
# note: k8s version pinned since KIND image availability lags k8s releases
KUBERNETES_VERSION ?= 1.26.0
KUBEBUILDER_VERSION ?= 3.8.0
KUSTOMIZE_VERSION ?= 3.8.9
BATS_VERSION ?= 1.8.2
ORAS_VERSION ?= 0.16.0
Expand Down Expand Up @@ -103,8 +102,10 @@ endif
all: lint test manager

# Run tests
native-test:
GO111MODULE=on go test -mod vendor ./pkg/... ./apis/... ./cmd/gator/... -race -bench . -coverprofile cover.out
native-test: envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBERNETES_VERSION) --bin-dir $(LOCALBIN) -p path)" \
GO111MODULE=on \
go test -mod vendor ./pkg/... ./apis/... ./cmd/gator/... -race -bench . -coverprofile cover.out

.PHONY: benchmark-test
benchmark-test:
Expand Down Expand Up @@ -456,8 +457,19 @@ __test-image:
--build-arg YQ_VERSION=$(YQ_VERSION) \
--build-arg BATS_VERSION=$(BATS_VERSION) \
--build-arg ORAS_VERSION=$(ORAS_VERSION) \
--build-arg KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) \
--build-arg KUBEBUILDER_VERSION=$(KUBEBUILDER_VERSION)
--build-arg KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION)

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/.tmp/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

ENVTEST ?= $(LOCALBIN)/setup-envtest

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20230118154835-9241bceb3098

.PHONY: vendor
vendor:
Expand Down
16 changes: 3 additions & 13 deletions test/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Build the manager binary
FROM golang:1.19-bullseye as builder

ARG BATS_VERSION
ARG ORAS_VERSION
ARG YQ_VERSION
ARG KUSTOMIZE_VERSION
ARG KUBEBUILDER_VERSION
ARG TARGETARCH

RUN apt-get update &&\
apt-get install -y apt-utils make
ARG TARGETARCH

# Install kubebuilder
WORKDIR /scratch
RUN curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_linux_${TARGETARCH}" &&\
mv kubebuilder_linux_${TARGETARCH} /usr/local/kubebuilder
ENV PATH=$PATH:/usr/local/kubebuilder/bin:/usr/bin
RUN apt-get update && \
apt-get install -y make jq

# Install kustomize
RUN curl -L -O "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_${TARGETARCH}.tar.gz" &&\
Expand All @@ -37,9 +30,6 @@ RUN curl -SsLO https://github.com/oras-project/oras/releases/download/v${ORAS_VE
RUN curl -LsS https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${TARGETARCH} -o /usr/local/bin/yq \
&& chmod +x /usr/local/bin/yq

# Install jq
RUN apt-get update && yes | apt-get install jq

# Install docker
RUN curl -fsSL https://get.docker.com | sh

Expand Down

0 comments on commit f33c367

Please sign in to comment.