Skip to content

Commit

Permalink
[Fix] fix go versions in CI and sanity tests
Browse files Browse the repository at this point in the history
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
  • Loading branch information
varshaprasad96 committed Aug 28, 2023
1 parent f7fc8d7 commit fcc10c8
Show file tree
Hide file tree
Showing 24 changed files with 70 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: install
uses: actions/setup-go@v3
with:
go-version: 1.20
go-version-file: go.mod

- name: gpg init
if: ${{ github.event_name != 'pull_request' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: make test-e2e-integration
12 changes: 6 additions & 6 deletions .github/workflows/test-ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: sudo rm -rf /usr/local/bin/kustomize
- run: make test-e2e-ansible

Expand All @@ -41,12 +41,12 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: sudo rm -rf /usr/local/bin/kustomize
- uses: actions/setup-python@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: make test-unit
- uses: shogo82148/actions-goveralls@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: sudo rm -rf /usr/local/bin/kustomize
- run: make test-e2e-helm
6 changes: 3 additions & 3 deletions .github/workflows/test-sample-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: sudo rm -rf /usr/local/bin/kustomize
- run: make test-e2e-sample-go
8 changes: 4 additions & 4 deletions .github/workflows/test-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
needs: check_docs_only
if: needs.check_docs_only.outputs.skip != 'true'
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
id: go
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
id: go
- run: sudo rm -rf /usr/local/bin/kustomize
- run: make test-sanity

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ test-docs: ## Test doc links

.PHONY: test-unit
TEST_PKGS = $(shell go list ./... | grep -v -E 'github.com/operator-framework/operator-sdk/test/')

KUBEBUILDER_ASSETS = $(PWD)/$(shell go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest && $(shell go env GOPATH)/bin/setup-envtest use $(K8S_VERSION) --bin-dir tools/bin/ -p path)
test-unit: ## Run unit tests
go test -coverprofile=coverage.out -covermode=count -short $(TEST_PKGS)

Expand Down
55 changes: 26 additions & 29 deletions changelog/fragments/01-bump-k8s-1.27.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ entries:
body: |
Bump the versions of controller-runtime, ginko. gomega and kubernetes dependencies to k8s 1.27 supported
versions. After migrating to the stable version in go/v4, ensure that the `go.mod` file looks as below:
```
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
sigs.k8s.io/controller-runtime v0.15.0
```
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
sigs.k8s.io/controller-runtime v0.15.0 ```
- description: >
- (ansible/v1, helm/v1) Remove multi-arch and node affinity patch from manager configurations.
kind: "change"
Expand Down Expand Up @@ -77,29 +76,28 @@ entries:
values:
- linux
```
- description: >
- (ansible/v1, helm/v1) Bump kube-rbac-proxy version from `0.13.1` to `0.14.1`
kind: "change"
breaking: true
migration:
header: (ansible/v1, helm/v1) Bump kube-rbac-proxy version
body: |
Bump the version of kube-rbac-proxy from `0.13.1` to `0.14.1`. In
`config/default/manager_auth_proxy_path.yaml`, ensure that `gcr.io/kubebuilder/kube-rbac-proxy`
has the right version:
- description: >
- (ansible/v1, helm/v1) Bump kube-rbac-proxy version from `0.13.1` to `0.14.1`
kind: "change"
breaking: true
migration:
header: (ansible/v1, helm/v1) Bump kube-rbac-proxy version
body: |
Bump the version of kube-rbac-proxy from `0.13.1` to `0.14.1`. In
`config/default/manager_auth_proxy_path.yaml`, ensure that `gcr.io/kubebuilder/kube-rbac-proxy`
has the right version:
```
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
```
- description: >
- (ansible/v1, helm/v1) Use kustomize version `v5.0.1` in projects.
kind: "change"
breaking: true
migration: (ansible/v1, helm/v1) Use kustomize version `v5.0.1`
```
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
```
- description: >
- (ansible/v1, helm/v1) Use kustomize version `v5.0.1` in projects.
kind: "change"
breaking: true
migration:
header: (ansible/v1, helm/v1) Use kustomize version `v5.0.1`
body: |
In `Makefile` replace the version in kustomize target. Replace:
```
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.0.1/kustomize_v4.5.7_$(OS)_$(ARCH).tar.gz |
```
Expand All @@ -108,4 +106,3 @@ entries:
```
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.0.1/kustomize_v5.0.1_$(OS)_$(ARCH).tar.gz |
```
2 changes: 1 addition & 1 deletion images/ansible-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETARCH

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion images/custom-scorecard-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the custom-scorecard-tests binary
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETARCH

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion images/helm-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETARCH

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion images/operator-sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the operator-sdk binary
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETARCH

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion images/scorecard-test-kuttl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the scorecard-test-kuttl binary
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETARCH
ARG BUILDPLATFORM

Expand Down
2 changes: 1 addition & 1 deletion images/scorecard-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the scorecard-test binary
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETARCH

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion testdata/ansible/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.31.0

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down
2 changes: 1 addition & 1 deletion testdata/go/v3/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.31.0

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down
2 changes: 1 addition & 1 deletion testdata/go/v3/monitoring/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.31.0

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down
2 changes: 1 addition & 1 deletion testdata/go/v4/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.31.0

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down
2 changes: 1 addition & 1 deletion testdata/go/v4/monitoring/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.31.0

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down
2 changes: 1 addition & 1 deletion testdata/helm/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.30.0
OPERATOR_SDK_VERSION ?= v1.31.0

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
Expand Down
2 changes: 1 addition & 1 deletion website/content/en/docs/cli/operator-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For more specific help for the init command of a certain plugins and project ver
configuration please run:
operator-sdk init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]
Default plugin keys: "go.kubebuilder.io/v3"
Default plugin keys: "go.kubebuilder.io/v4"
Default project version: "3"
```
Expand Down
5 changes: 3 additions & 2 deletions website/content/en/docs/cli/operator-sdk_create_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ operator-sdk create api [flags]
operator-sdk create api --group ship --version v1beta1 --kind Frigate
# Edit the API Scheme
nano api/v1beta1/frigate_types.go
# Edit the Controller
nano controllers/frigate/frigate_controller.go
nano internal/controller/frigate/frigate_controller.go
# Edit the Controller Test
nano controllers/frigate/frigate_controller_test.go
nano internal/controller/frigate/frigate_controller_test.go
# Generate the manifests
make manifests
Expand Down
7 changes: 3 additions & 4 deletions website/content/en/docs/cli/operator-sdk_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Initialize a new project including the following files:
- a "PROJECT" file that stores project configuration
- a "Makefile" with several useful make targets for the project
- several YAML files for project deployment under the "config" directory
- a "main.go" file that creates the manager that will run the project controllers
- a "cmd/main.go" file that creates the manager that will run the project controllers


```
Expand All @@ -23,17 +23,16 @@ operator-sdk init [flags]

```
# Initialize a new project with your domain and name in copyright
operator-sdk init --plugins go/v3 --domain example.org --owner "Your name"
operator-sdk init --plugins go/v4 --domain example.org --owner "Your name"
# Initialize a new project defining a specific project version
operator-sdk init --plugins go/v3 --project-version 3
operator-sdk init --plugins go/v4 --project-version 3
```

### Options

```
--component-config create a versioned ComponentConfig file, may be 'true' or 'false'
--domain string domain for groups (default "my.domain")
--fetch-deps ensure dependencies are downloaded (default true)
-h, --help help for init
Expand Down

0 comments on commit fcc10c8

Please sign in to comment.