Skip to content
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

fix: update tooling pipeline and vendor most critical tool binaries #1945

Merged
merged 10 commits into from
Mar 3, 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
1 change: 0 additions & 1 deletion .github/workflows/ai-proxy-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
go-version-file: go/ai-proxy/go.mod
cache: true
- run: go mod download
- run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make test

publish-docker:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ai-proxy-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
go-version-file: go/ai-proxy/go.mod
cache: true
- run: go mod download
- run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make build

check:
Expand All @@ -48,5 +47,4 @@ jobs:
go-version-file: go/ai-proxy/go.mod
cache: true
- run: go mod download
- run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make check
2 changes: 0 additions & 2 deletions .github/workflows/controller-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:
cache: true
- name: Download dependencies
run: go mod download
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- name: Test
run: PATH=$PATH:$GOPATH/bin make test
publish-docker:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/controller-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
cache: true
- name: Download dependencies
run: go mod download
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make build
unit-test:
name: Unit tests
Expand All @@ -53,8 +51,6 @@ jobs:
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- name: Test
run: PATH=$PATH:$GOPATH/bin make test
lint:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download tools
working-directory: go
run: PATH=$PATH:$GOPATH/bin make tools
- name: Regenerate docs
working-directory: go/controller
run: PATH=$PATH:$GOPATH/bin make codegen-crd-docs
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/oci-auth-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
go-version-file: go/oci-auth/go.mod
cache: true
- run: go mod download
- run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make test
publish-docker:
name: Build and push oci-auth container
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/oci-auth-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
go-version-file: go/oci-auth/go.mod
cache: true
- run: go mod download
- run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make build
unit-test:
name: Unit tests
Expand All @@ -50,7 +49,6 @@ jobs:
go-version-file: go/oci-auth/go.mod
cache: true
- run: go mod download
- run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make test
lint:
name: Lint
Expand All @@ -63,6 +61,6 @@ jobs:
check-latest: true
- uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
version: v1.59
version: v1.61
working-directory: go/oci-auth
args: --timeout=30m
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ data/

# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json

# Ignore locally vendored project tools binaries
binaries/
2 changes: 1 addition & 1 deletion go/ai-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the binary
FROM golang:1.22.8 as builder
FROM golang:1.23.4 as builder
ARG TARGETOS
ARG TARGETARCH
ARG VERSION
Expand Down
14 changes: 9 additions & 5 deletions go/ai-proxy/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/../..

include $(ROOT_DIRECTORY)/go/paths.mk
include $(TOOLS_BINARIES_MAKEFILE)
include $(TOOLS_MAKEFILE)

DIST_DIR := dist
BINARY_NAME := ai-proxy
Expand Down Expand Up @@ -54,10 +54,12 @@ docker:
##@ Tests / Lint

.PHONY: check
check: vet lint test ## run all code checks/tests
check: TOOL = goimports golangci-lint
check: --tool vet lint test ## run all code checks/tests

.PHONY: goimports
goimports: ## format code imports
goimports: TOOL = goimports
goimports: --tool ## format code imports
@$(GOIMPORTS) -w ./

.PHONY: fmt
Expand All @@ -69,11 +71,13 @@ vet: ## run go vet
@go vet ./...

.PHONY: lint
lint: ## run linters
lint: TOOL = golangci-lint
lint: --tool ## run linters
@$(GOLANGCI_LINT) run ./...

.PHONY: fix
fix: fmt ## fix issues found by linters
fix: TOOL = golangci-lint
fix: --tool fmt ## fix issues found by linters
@$(GOLANGCI_LINT) run --fix ./...

.PHONY: test
Expand Down
3 changes: 1 addition & 2 deletions go/ai-proxy/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pluralsh/console/go/ai-proxy

go 1.22.8
go 1.23.4

require (
github.com/andybalholm/brotli v1.1.1
Expand Down Expand Up @@ -53,7 +53,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/sashabaranov/go-openai v1.37.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.11.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go/ai-proxy/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/sashabaranov/go-openai v1.37.0 h1:hQQowgYm4OXJ1Z/wTrE+XZaO20BYsL0R3uRPSpfNZkY=
github.com/sashabaranov/go-openai v1.37.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
6 changes: 4 additions & 2 deletions go/client/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/../..

include $(ROOT_DIRECTORY)/go/paths.mk
include $(TOOLS_BINARIES_MAKEFILE)
include $(TOOLS_MAKEFILE)

##@ General

.PHONY: help
help: ## show help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

generate: ## generate Go client from GraphQL schema
.PHONY: generate:
generate: TOOL = gqlgenc
generate: --tool ## generate Go client from GraphQL schema
@$(GQLGENC)

release: ## create and push a tag with new client version
Expand Down
2 changes: 1 addition & 1 deletion go/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.23 as builder
FROM golang:1.23.4 as builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
38 changes: 25 additions & 13 deletions go/controller/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/../..

include $(ROOT_DIRECTORY)/go/paths.mk
include $(TOOLS_BINARIES_MAKEFILE)
include $(TOOLS_MAKEFILE)

# Image tag used to deploy controller with helm
IMG_TAG ?= master
Expand Down Expand Up @@ -62,16 +62,19 @@ vet: ## run go vet against code
@go vet ./...

.PHONY: lint
lint: ## run linters
lint: TOOL = golangci-lint
lint: --tool ## run linters
@$(GOLANGCI_LINT) run ./...

.PHONY: fix
fix: ## fix issues found by linters
fix: TOOL = golangci-lint
fix: --tool ## fix issues found by linters
@$(GOLANGCI_LINT) run --fix ./...

.PHONY: test
test: manifests generate genmock fmt vet ## run tests
@KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(GOPATH)/bin -p path)" go test $$(go list ./... | grep -v /e2e) -v
test: TOOL = envtest controller-gen mockery
test: --tool manifests generate genmock fmt vet ## run tests
@KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(BINARIES_DIR) -p path)" go test $$(go list ./... | grep -v /e2e) -v

.PHONY: e2e
e2e: ## run e2e tests
Expand All @@ -83,20 +86,24 @@ e2e: ## run e2e tests
codegen: manifests generate genmock codegen-helm codegen-crd-docs ## runs all codegen-related targets

.PHONY: manifests
manifests: ## generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects
manifests: TOOL = controller-gen
manifests: --tool ## generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
@$(MAKE) -s codegen-chart-crds

.PHONY: generate
generate: ## generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations
generate: TOOL = controller-gen
generate: --tool ## generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations
$(CONTROLLER_GEN) object:headerFile=$(BOILERPLATE_FILE) paths="./..."

.PHONY: genmock
genmock: TOOL = mockery
genmock: ## generates mocks before running tests
$(MOCKERY)

.PHONY: codegen-helm
codegen-helm: manifests ## generate controller helm chart with kustomize
codegen-helm: TOOL = kustomize helmify
codegen-helm: --tool manifests ## generate controller helm chart with kustomize
@rm -rf tmp/
@$(KUSTOMIZE) build config/default | $(HELMIFY) -generate-defaults -image-pull-secrets -crd-dir tmp/charts/controller
@find tmp/charts/controller -type f -exec sed -i 's/app.kubernetes.io\/managed-by: kustomize/app.kubernetes.io\/managed-by: helm/g' {} \;
Expand All @@ -107,29 +114,34 @@ codegen-chart-crds: ## copy CRDs to the controller helm chart
@cp -a $(CONTROLLER_CHART_DIR)/crds/. $(PLURAL_CONSOLE_CHART_DIR)/crds

.PHONY: codegen-crd-docs
codegen-crd-docs: ## generate docs from the CRDs
codegen-crd-docs: TOOL = crd-ref-docs
codegen-crd-docs: --tool ## generate docs from the CRDs
$(CRDDOCS) --source-path=./api --renderer=markdown --output-path=./docs/api.md --config=config.yaml

##@ Deployment

.PHONY: deploy-crds-kustomize
deploy-crds-kustomize: manifests ## deploy CRDs into the K8s cluster specified in ~/.kube/config.
deploy-crds-kustomize: TOOL = kustomize
deploy-crds-kustomize: --tool manifests ## deploy CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -

ifndef ignore-not-found
ignore-not-found = false
endif

.PHONY: undeploy-crds-kustomize
undeploy-crds-kustomize: manifests ## undeploy CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
undeploy-crds-kustomize: TOOL = kustomize
undeploy-crds-kustomize: --tool manifests ## undeploy CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: deploy-kustomize
deploy-kustomize: manifests deploy-crds-kustomize ## deploy controller to the K8s cluster specified in ~/.kube/config.
deploy-kustomize: TOOL = kustomize
deploy-kustomize: --tool manifests deploy-crds-kustomize ## deploy controller to the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | $(ENVSUBST) | $(KUBECTL) apply -f -

.PHONY: undeploy-kustomize
undeploy-kustomize: manifests ## undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
undeploy-kustomize: TOOL = kustomize
undeploy-kustomize: --tool manifests ## undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: deploy-helm
Expand Down
4 changes: 1 addition & 3 deletions go/controller/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/pluralsh/console/go/controller

go 1.23.0

toolchain go1.23.5
go 1.23.4

require (
github.com/Yamashou/gqlgenc v0.29.0
Expand Down
1 change: 0 additions & 1 deletion go/oci-auth/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linters:
- dupl
- durationcheck
- errcheck
- exportloopref
- forcetypeassert
- goconst
- gocyclo
Expand Down
2 changes: 1 addition & 1 deletion go/oci-auth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22 as builder
FROM golang:1.23.4 as builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
8 changes: 5 additions & 3 deletions go/oci-auth/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/../..

include $(ROOT_DIRECTORY)/go/paths.mk
include $(TOOLS_BINARIES_MAKEFILE)
include $(TOOLS_MAKEFILE)

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -40,11 +40,13 @@ release: lint test ## builds release version of the app, requires GoReleaser to
##@ Checks

.PHONY: lint
lint: ## run linters
lint: TOOL = golangci-lint
lint: --tool ## run linters
@$(GOLANGCI_LINT) run ./...

.PHONY: fix
fix: ## run linters and fix found issues
fix: TOOL = golangci-lint
fix: --tool ## run linters and fix found issues
@$(GOLANGCI_LINT) run --fix ./...

.PHONY: test
Expand Down
2 changes: 1 addition & 1 deletion go/oci-auth/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pluralsh/console/go/oci-auth

go 1.22.5
go 1.23.4

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1
Expand Down
23 changes: 22 additions & 1 deletion go/paths.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# Paths
CONTROLLER_CHART_DIR := $(ROOT_DIRECTORY)/charts/controller
PLURAL_CONSOLE_CHART_DIR := $(ROOT_DIRECTORY)/plural/helm/console
WORKSPACES_DIR := $(ROOT_DIRECTORY)/go
TOOLS_DIR := $(WORKSPACES_DIR)/tools
TOOLS_BINARIES_MAKEFILE := $(TOOLS_DIR)/binaries.mk
TOOLS_MAKEFILE := $(TOOLS_DIR)/Makefile
BOILERPLATE_FILE := $(TOOLS_DIR)/boilerplate.go.txt
CLIENT_DIR := $(WORKSPACES_DIR)/client
CONTROLLER_DIR := $(WORKSPACES_DIR)/controller
BINARIES_DIR := $(ROOT_DIRECTORY)/binaries

# Tool binaries
CONTROLLER_GEN ?= $(BINARIES_DIR)/controller-gen
CRDDOCS ?= $(BINARIES_DIR)/crd-ref-docs
ENVSUBST ?= $(BINARIES_DIR)/envsubst
ENVTEST ?= $(BINARIES_DIR)/setup-envtest
GOIMPORTS ?= $(BINARIES_DIR)/goimports
GOLANGCI_LINT ?= $(BINARIES_DIR)/golangci-lint
GQLGEN ?= $(BINARIES_DIR)/gqlgen
GQLGENC ?= $(BINARIES_DIR)/gqlgenc
HELMIFY := $(BINARIES_DIR)/helmify
KUBEBUILDER ?= $(BINARIES_DIR)/kubebuilder
KUSTOMIZE ?= $(BINARIES_DIR)/kustomize
MOCKERY ?= $(BINARIES_DIR)/mockery

# Global tool binaries
HELM ?= $(shell which helm)
GO ?= $(shell which go)
KUBECTL ?= $(shell which kubectl)
Loading
Loading