Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Update test env Kube to lowest supported (#234)
Browse files Browse the repository at this point in the history
* Update test env Kube to lowest supported

* Upgrade Go to 1.18

* Upgrade Gothub actions Go version too

* Try to solve mockgen not found issue

* Update envtest and fix Shared volume tests
  • Loading branch information
mhmxs authored Sep 20, 2022
1 parent de893c6 commit a7cde31
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/linters-cfg/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ linters-settings:
# report about shadowed variables
check-shadowing: false
gosimple:
go: "1.17"
go: "1.18"
checks: [ "-S1019" ]
forbidigo:
forbid:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2
- name: Run linter
Expand Down Expand Up @@ -113,9 +113,9 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Run tests
run: make test
run: PATH=$PWD/bin:$PATH make test

build:
name: Build binary
Expand All @@ -125,7 +125,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2
- name: Build binary
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Install kuttl and kubectl
run: |
sudo curl -Lo $KUTTL https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.22.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Install kuttl and kubectl
run: |
sudo curl -Lo $KUTTL https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.23.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Install kuttl and kubectl
run: |
sudo curl -Lo $KUTTL https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Install kuttl and kubectl
run: |
sudo curl -Lo $KUTTL https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.25.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17'
go-version: '1.18'
- name: Install kuttl and kubectl
run: |
sudo curl -Lo $KUTTL https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.17.11 as builder
FROM golang:1.18 as builder

WORKDIR /workspace
COPY . /workspace
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ RELATED_IMAGE_METRICS_EXPORTER=${METRICS_EXPORTER_IMAGE}
endef
export REL_IMAGE_CONF

# KUBEBUILDER_ASSETS path is set as environment variable when running envtest.
ENVTEST_BIN_VERSION = 1.21.4
KUBEBUILDER_ASSETS = $(shell $(SETUP_ENVTEST) use -i -p path $(ENVTEST_BIN_VERSION))

_env:
env

Expand Down Expand Up @@ -133,11 +137,9 @@ metrics-exporter:
lint: ## Run golangci-lint
golangci-lint run --config .github/linters-cfg/.golangci.yml

ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: ## Run unit tests
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
test: manifests generate setup-envtest ## Run unit tests
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
go test ./... -coverprofile cover.out

.PHONY: e2e
e2e: ## Run end to end tests
Expand Down Expand Up @@ -222,6 +224,11 @@ bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metada

##@ Deps

SETUP_ENVTEST = $(shell pwd)/bin/setup-envtest
setup-envtest:
$(call go-get-tool,$(SETUP_ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
$(SETUP_ENVTEST) use $(ENVTEST_BIN_VERSION)

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.0)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/storageos/operator

go 1.17
go 1.18

require (
github.com/blang/semver v3.5.1+incompatible
Expand Down
Loading

0 comments on commit a7cde31

Please sign in to comment.