Skip to content

Use Gimme to automatically install the correct Go version #735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/coherence-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/compatibility-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/doc-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/istio-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/k3d-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/k8s-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/minikube-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/prometheus-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/tanzu-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ jobs:
website: oracle.com
release: 21

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Cache Go Modules
uses: actions/cache@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.24.2
34 changes: 21 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ PROJECT_URL = https://github.com/oracle/coherence-operator

KUBERNETES_DOC_VERSION=v1.32

# ========================= Setup Go With Gimme ================================
# go version to use for build etc.
# setup correct go version with gimme
GOTOOLCHAIN:=$(shell . hack/golang/gotoolchain.sh && echo "$${GOTOOLCHAIN}")
PATH:=$(shell . hack/golang/setup-go.sh && echo "$${PATH}")
# go1.9+ can autodetect GOROOT, but if some other tool sets it ...
GOROOT:=
# enable modules
GO111MODULE=on
# disable CGO by default for static binaries
CGO_ENABLED=0
export PATH GOROOT GO111MODULE CGO_ENABLED GOTOOLCHAIN
# work around broken PATH export
SPACE:=$(subst ,, )
SHELL:=env PATH=$(subst $(SPACE),\$(SPACE),$(PATH)) $(SHELL)

# ----------------------------------------------------------------------------------------------------------------------
# Operator image names
# ----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -561,9 +577,9 @@ $(BUILD_TARGETS)/delve-image:

$(BUILD_BIN)/runner-debug: $(BUILD_PROPS) $(GOS) $(BUILD_TARGETS)/generate $(BUILD_TARGETS)/manifests
mkdir -p $(BUILD_BIN_AMD64) || true
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -gcflags "-N -l" -ldflags "$(LDFLAGS)" -a -o $(BUILD_BIN_AMD64)/runner-debug ./runner
GOOS=linux GOARCH=amd64 GO111MODULE=on go build -gcflags "-N -l" -ldflags "$(LDFLAGS)" -a -o $(BUILD_BIN_AMD64)/runner-debug ./runner
mkdir -p $(BUILD_BIN_ARM64)/linux || true
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -gcflags "-N -l" -ldflags "$(LDFLAGS)" -a -o $(BUILD_BIN_ARM64)/runner-debug ./runner
GOOS=linux GOARCH=arm64 GO111MODULE=on go build -gcflags "-N -l" -ldflags "$(LDFLAGS)" -a -o $(BUILD_BIN_ARM64)/runner-debug ./runner
ifeq (x86_64, $(UNAME_M))
cp -f $(BUILD_BIN_AMD64)/runner-debug $(BUILD_BIN)/runner-debug
else
Expand Down Expand Up @@ -706,9 +722,9 @@ build-runner: $(BUILD_BIN)/runner ## Build the Coherence Operator runner binary

$(BUILD_BIN)/runner: $(BUILD_PROPS) $(GOS) $(BUILD_TARGETS)/generate $(BUILD_TARGETS)/manifests
mkdir -p $(BUILD_BIN_AMD64) || true
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_BIN_AMD64)/runner ./runner
GOOS=linux GOARCH=amd64 GO111MODULE=on go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_BIN_AMD64)/runner ./runner
mkdir -p $(BUILD_BIN_ARM64)/linux || true
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -trimpath -ldflags "$(LDFLAGS)" -a -o $(BUILD_BIN_ARM64)/runner ./runner
GOOS=linux GOARCH=arm64 GO111MODULE=on go build -trimpath -ldflags "$(LDFLAGS)" -a -o $(BUILD_BIN_ARM64)/runner ./runner
ifeq (x86_64, $(UNAME_M))
cp -f $(BUILD_BIN_AMD64)/runner $(BUILD_BIN)/runner
else
Expand Down Expand Up @@ -886,6 +902,7 @@ copyright: ## Check copyright headers
-X .factories \
-X hack/codestyle/copyright.txt \
-X hack/codestyle/intellij-codestyle.xml \
-X hack/gimme/ \
-X hack/install-cohctl.sh \
-X hack/istio- \
-X hack/sdk/ \
Expand Down Expand Up @@ -1242,7 +1259,6 @@ oc-login:
# Executes the Go unit tests that do not require a k8s cluster
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: test-operator
test-operator: export CGO_ENABLED = 0
test-operator: export COHERENCE_IMAGE := $(COHERENCE_IMAGE)
test-operator: export OPERATOR_IMAGE := $(OPERATOR_IMAGE)
test-operator: $(BUILD_PROPS) $(BUILD_TARGETS)/manifests $(BUILD_TARGETS)/generate install-crds gotestsum ## Run the Operator unit tests
Expand Down Expand Up @@ -1293,7 +1309,6 @@ $(TOOLS_BIN)/k8s: $(TOOLS_BIN)/setup-envtest
# is pointing to.
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: e2e-local-test
e2e-local-test: export CGO_ENABLED = 0
e2e-local-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
e2e-local-test: export CLUSTER_NAMESPACE := $(CLUSTER_NAMESPACE)
e2e-local-test: export OPERATOR_NAMESPACE_CLIENT := $(OPERATOR_NAMESPACE_CLIENT)
Expand Down Expand Up @@ -1345,7 +1360,6 @@ e2e-test: prepare-e2e-test ## Run the Operator end-to-end 'remote' functional te
prepare-e2e-test: reset-namespace create-ssl-secrets ensure-pull-secret deploy-and-wait

.PHONY: run-e2e-test
run-e2e-test: export CGO_ENABLED = 0
run-e2e-test: export TEST_SSL_SECRET := $(TEST_SSL_SECRET)
run-e2e-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
run-e2e-test: export CLUSTER_NAMESPACE := $(CLUSTER_NAMESPACE)
Expand Down Expand Up @@ -1381,7 +1395,6 @@ run-e2e-test: gotestsum ## Run the Operator 'remote' end-to-end functional test
# is pointing to.
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: e2e-k3d-test
e2e-k3d-test: export CGO_ENABLED = 0
e2e-k3d-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
e2e-k3d-test: export CLUSTER_NAMESPACE := $(CLUSTER_NAMESPACE)
e2e-k3d-test: export OPERATOR_NAMESPACE_CLIENT := $(OPERATOR_NAMESPACE_CLIENT)
Expand Down Expand Up @@ -1417,7 +1430,6 @@ e2e-k3d-test: reset-namespace create-ssl-secrets gotestsum undeploy install-crds
# ----------------------------------------------------------------------------------------------------------------------
# Run the end-to-end Coherence client tests.
# ----------------------------------------------------------------------------------------------------------------------
e2e-client-test: export CGO_ENABLED = 0
e2e-client-test: export CLIENT_CLASSPATH := $(CURRDIR)/java/operator-test-client/target/operator-test-client-$(MVN_VERSION).jar:$(CURRDIR)/java/operator-test-client/target/lib/*
e2e-client-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
e2e-client-test: export OPERATOR_NAMESPACE_CLIENT := $(OPERATOR_NAMESPACE_CLIENT)
Expand Down Expand Up @@ -1475,7 +1487,6 @@ e2e-prometheus-test: reset-namespace install-prometheus create-ssl-secrets ensur
; exit $$rc

.PHONY: run-prometheus-test
run-prometheus-test: export CGO_ENABLED = 0
run-prometheus-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
run-prometheus-test: export TEST_APPLICATION_IMAGE := $(TEST_APPLICATION_IMAGE)
run-prometheus-test: export TEST_APPLICATION_IMAGE_HELIDON := $(TEST_APPLICATION_IMAGE_HELIDON)
Expand Down Expand Up @@ -1511,7 +1522,6 @@ run-prometheus-test: gotestsum
compatibility-test: undeploy build-all-images helm-chart undeploy clean-namespace reset-namespace ensure-pull-secret gotestsum just-compatibility-test ## Run the Operator backwards compatibility tests

.PHONY: just-compatibility-test
just-compatibility-test: export CGO_ENABLED = 0
just-compatibility-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
just-compatibility-test: export CLUSTER_NAMESPACE := $(CLUSTER_NAMESPACE)
just-compatibility-test: export BUILD_OUTPUT := $(BUILD_OUTPUT)
Expand Down Expand Up @@ -1572,7 +1582,6 @@ install-certification: $(BUILD_TARGETS)/build-operator prepare-network-policies
# Note that the namespace will be created if it does not exist.
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: run-certification
run-certification: export CGO_ENABLED = 0
run-certification: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
run-certification: export CLUSTER_NAMESPACE := $(CLUSTER_NAMESPACE)
run-certification: export BUILD_OUTPUT := $(BUILD_OUTPUT)
Expand Down Expand Up @@ -1729,7 +1738,6 @@ install-coherence-compatibility: $(BUILD_TARGETS)/build-operator reset-namespace
# Note that the namespace will be created if it does not exist.
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: run-coherence-compatibility
run-coherence-compatibility: export CGO_ENABLED = 0
run-coherence-compatibility: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
run-coherence-compatibility: export TEST_COMPATIBILITY_IMAGE := $(TEST_COMPATIBILITY_IMAGE)
run-coherence-compatibility: export IMAGE_PULL_SECRETS := $(IMAGE_PULL_SECRETS)
Expand Down
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
module github.com/oracle/coherence-operator

// NOTE: This is the go language version, NOT the compiler version.
//
// This controls the *minimum* required go version and therefore available Go
// language features.
//
// See ./.go-version for the go compiler version used when building binaries
//
// https://go.dev/doc/modules/gomod-ref#go
go 1.24.2

require (
Expand Down
21 changes: 21 additions & 0 deletions hack/gimme/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015-2018 gimme contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions hack/gimme/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# gimme

This is an unmodified copy of [gimme], so we don't have to download it
from the internet.

[gimme]: https://github.com/travis-ci/gimme
Loading