Skip to content

Commit

Permalink
fix: add event markers and update go version (#73)
Browse files Browse the repository at this point in the history
* fix: added missing events marker

This was missed when we recently added changes to add events to deployed resources.

Signed-off-by: Dustin Scott <[email protected]>

* feat: switch to gener8s over legacy ocgk package

Signed-off-by: Dustin Scott <[email protected]>

* fix: enforce go 1.22

Because a future version of go (e.g. go 1.23) is not out yet, we are on the
latest version.  For the operator-builder binary, we are not dependent on
layered go versions (e.g. generated code go versions) so we have more flexibility
in version selection.  Removed the multiple array selection, but left it as an
array in case we want to test future versions when they release, or multiple
versions for whatever the case may be.

Signed-off-by: Dustin Scott <[email protected]>

* test: add ability to use different binary versions versus codebase version

This is because the go binary can be built on different versions than
the codebase itself.

Signed-off-by: Dustin Scott <[email protected]>

* feat: use 1.22 in go mod

Signed-off-by: Dustin Scott <[email protected]>

* feat: add toolchain for dealing with lower go versions

Signed-off-by: Dustin Scott <[email protected]>

* test: add flag to prevent binary builds when requested

This is because we were duplicating the operator-builder build in the pipeline.

Signed-off-by: Dustin Scott <[email protected]>

* docs: update go version in docs

Signed-off-by: Dustin Scott <[email protected]>

* ci: update kind and kubectl versions in pipeline

Signed-off-by: Dustin Scott <[email protected]>

* ci: update goreleaser and remove deprecated fields

Signed-off-by: Dustin Scott <[email protected]>

---------

Signed-off-by: Dustin Scott <[email protected]>
  • Loading branch information
scottd018 committed May 22, 2024
1 parent 3a887b7 commit 5b843c8
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 173 deletions.
4 changes: 2 additions & 2 deletions .github/common-actions/e2e-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ runs:
echo "found kubectl executable at $(which kubectl)...not installing"
fi
env:
KIND_VERSION: v0.12.0
KUBECTL_VERSION: v1.23.0
KIND_VERSION: v0.22.0
KUBECTL_VERSION: v1.29.3

- name: Setup KIND Cluster
shell: bash
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ jobs:
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist -f ./.goreleaser.yml
args: release --clean -f ./.goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

15 changes: 11 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
fail-fast: false
matrix:
include:
- go-version: "1.21"
# NOTE: we may test on multiple versions here when a future version of go releases, but
# for now we can leave this as a single array.
- go-version: "1.22"
steps:
- name: Checkout Code
Expand All @@ -42,7 +43,8 @@ jobs:
fail-fast: false
matrix:
include:
- go-version: "1.21"
# NOTE: we may test on multiple versions here when a future version of go releases, but
# for now we can leave this as a single array.
- go-version: "1.22"
steps:
- name: Checkout Code
Expand Down Expand Up @@ -79,18 +81,22 @@ jobs:
artifact: standalone-codebase
test-workload-path: test/cases/standalone
go-version: "1.22"
binary-go-version: "1.22"
- name: Standalone Edge Cases Operator (Current Go Version - 1)
artifact: standalone-edge-codebase
test-workload-path: test/cases/edge-standalone
go-version: "1.21"
binary-go-version: "1.22"
- name: Workload Collection Operator (Current Go Version)
artifact: collection-codebase
test-workload-path: test/cases/collection
go-version: "1.22"
binary-go-version: "1.22"
- name: Workload Collection Edge Cases Operator (Current Go Version - 1)
artifact: collection-edge-codebase
test-workload-path: test/cases/edge-collection
go-version: "1.21"
binary-go-version: "1.22"
env:
TEST_WORKLOAD_PATH: "${{ matrix.test-workload-path }}"
TEST_PATH: "/tmp/operator-builder-func-test"
Expand All @@ -103,7 +109,7 @@ jobs:
- name: Download operator-builder Binary
uses: actions/download-artifact@v4
with:
name: operator-builder-${{ matrix.go-version }}
name: operator-builder-${{ matrix.binary-go-version }}
path: bin

- name: Setup Go
Expand All @@ -115,7 +121,8 @@ jobs:
run: |
chmod +x bin/operator-builder
make func-test-clean
make func-test-init
# NOTE: do not rebuild the binary here since we just downloaded above
INIT_BUILD=false make func-test-init
- name: Create ${{ matrix.name }} Codebase
run: make func-test-create
Expand Down
12 changes: 3 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ builds:
- -s -w -X github.com/nukleros/operator-builder/pkg/cli.version={{ .Version }} -extldflags '-static'

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
name_template: "operator-builder_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
- name_template: '{{ .Binary }}_v{{ .Version }}_{{ tolower .Os }}_{{ if (eq .Arch "amd64") }}x86_64{{ else if (eq .Arch "386") }}i386{{ else }}{{ .Arch }}{{ end }}'
format_overrides:
- goos: windows
format: zip
Expand Down Expand Up @@ -61,7 +55,7 @@ dockers:
- "--platform=linux/amd64"
brews:
- name: operator-builder
tap:
repository:
owner: nukleros
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
Expand All @@ -74,7 +68,7 @@ brews:

# Folder inside the repository to put the formula.
# Default is the root folder.
folder: Formula
directory: Formula

# Your app's homepage.
# Default is empty.
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export OPERATOR_BUILDER_PATH := $(BASE_DIR)/bin

.PHONY: build install test debug

build_command = go build -o bin/operator-builder cmd/operator-builder/main.go
build:
go build -o bin/operator-builder cmd/operator-builder/main.go
$(call build_command)

install: build
sudo cp bin/operator-builder /usr/local/bin/operator-builder
Expand Down Expand Up @@ -76,7 +77,9 @@ FUNC_TEST_PATH ?= /tmp/operator-builder-func-test
func-test-clean:
if [ -d $(FUNC_TEST_PATH) ]; then rm -rf $(FUNC_TEST_PATH)/*; fi

func-test-init: build func-test-clean
INIT_BUILD ?= true
func-test-init: func-test-clean
if [ "$(INIT_BUILD)" == "true" ]; then $(call build_command); fi
$(call create_path,$(FUNC_TEST_PATH))
cp -r $(BASE_DIR)/$(TEST_WORKLOAD_PATH)/.workloadConfig/* $(FUNC_TEST_PATH)/.workloadConfig ;
cd $(FUNC_TEST_PATH) && $(OPERATOR_BUILDER_PATH)/operator-builder $(INIT_OPTS)
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Prerequisites

- Make
- Go version 1.16 or later
- Go version 1.22 or later
- Docker (for building/pushing controller images)
- An available test cluster. A local kind or minikube cluster will work just
fine in many cases.
Expand Down
22 changes: 12 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module github.com/nukleros/operator-builder

go 1.18
go 1.22

toolchain go1.22.1

require (
github.com/go-playground/validator v9.31.0+incompatible
github.com/nukleros/gener8s v0.1.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/afero v1.9.3
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
github.com/vmware-tanzu-labs/object-code-generator-for-k8s v0.5.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.24.2
k8s.io/client-go v0.24.2
Expand All @@ -27,20 +29,20 @@ require (
github.com/gobuffalo/flect v1.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
Expand Down
Loading

0 comments on commit 5b843c8

Please sign in to comment.