Skip to content

Commit

Permalink
drop use of GOBIN
Browse files Browse the repository at this point in the history
Signed-off-by: Isabella do Amaral <[email protected]>
  • Loading branch information
isinyaaa committed Aug 20, 2024
1 parent 71f8e2b commit 938d68e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: install go deps
run: make go-deps
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ COPY patches/ patches/
COPY templates/ templates/

# Download tools
RUN make deps
RUN make deps go-deps

# Build
USER root
Expand Down
39 changes: 14 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
PROJECT_BIN := $(PROJECT_PATH)/bin
GO := $(PROJECT_BIN)/go1.21.9
GO ?= "$(shell which go)"

# add tools bin directory
PATH := $(PROJECT_BIN):$(PATH)
Expand Down Expand Up @@ -64,7 +64,7 @@ internal/ml_metadata/proto/%.pb.go: api/grpc/ml_metadata/proto/%.proto
gen/grpc: internal/ml_metadata/proto/metadata_store.pb.go internal/ml_metadata/proto/metadata_store_service.pb.go

internal/converter/generated/converter.go: internal/converter/*.go
${GOVERTER} gen github.com/kubeflow/model-registry/internal/converter/
goverter gen github.com/kubeflow/model-registry/internal/converter/

.PHONY: gen/converter
gen/converter: gen/grpc internal/converter/generated/converter.go
Expand Down Expand Up @@ -104,34 +104,23 @@ vet:
clean:
rm -Rf ./model-registry internal/ml_metadata/proto/*.go internal/converter/generated/*.go pkg/openapi

.PHONY: clean/odh
clean/odh:
.PHONY: clean/docker
clean/docker:
rm -Rf ./model-registry

bin/go:
GOBIN=$(PROJECT_BIN) go install golang.org/dl/go1.21.9@latest
$(PROJECT_BIN)/go1.21.9 download

bin/protoc:
./scripts/install_protoc.sh

bin/go-enum:
GOBIN=$(PROJECT_BIN) ${GO} install github.com/searKing/golang/tools/[email protected]

bin/protoc-gen-go:
GOBIN=$(PROJECT_BIN) ${GO} install google.golang.org/protobuf/cmd/[email protected]

bin/protoc-gen-go-grpc:
GOBIN=$(PROJECT_BIN) ${GO} install google.golang.org/grpc/cmd/[email protected]
go-deps:
${GO} install github.com/searKing/golang/tools/[email protected]
${GO} install google.golang.org/protobuf/cmd/[email protected]
${GO} install google.golang.org/grpc/cmd/[email protected]
${GO} install github.com/jmattheis/goverter/cmd/[email protected]

GOLANGCI_LINT ?= ${PROJECT_BIN}/golangci-lint
bin/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_BIN) v1.59.1

GOVERTER ?= ${PROJECT_BIN}/goverter
bin/goverter:
GOBIN=$(PROJECT_PATH)/bin ${GO} install github.com/jmattheis/goverter/cmd/[email protected]

OPENAPI_GENERATOR ?= ${PROJECT_BIN}/openapi-generator-cli
NPM ?= "$(shell which npm)"
bin/openapi-generator-cli:
Expand All @@ -155,19 +144,19 @@ clean/deps:
rm -Rf bin/*

.PHONY: deps
deps: bin/go bin/protoc bin/go-enum bin/protoc-gen-go bin/protoc-gen-go-grpc bin/golangci-lint bin/goverter bin/openapi-generator-cli
deps: bin/protoc bin/golangci-lint bin/openapi-generator-cli

.PHONY: vendor
vendor:
${GO} mod vendor

.PHONY: build
build: gen vet lint
${GO} build -buildvcs=false
${GO} build

.PHONY: build/odh
build/odh: vet
${GO} build -buildvcs=false
.PHONY: build/docker
build/docker: vet
${GO} build

.PHONY: gen
gen: deps gen/grpc gen/openapi gen/openapi-server gen/converter
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ Model registry provides a central repository for model developers to store and m

## Pre-requisites:
- go >= 1.21
- go-enum >= 1.2.97
- protoc-gen-go >= 1.31.0
- protoc-gen-go-grpc >= 1.3.0
- goverter >= 1.4.1
- protoc v24.3 - [Protocol Buffers v24.3 Release](https://github.com/protocolbuffers/protobuf/releases/tag/v24.3)
- npm >= 10.2.0 - [Installing Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- Java >= 11.0
- python 3.9

To install the go dependencies you can use

```sh
make go-deps
```

## OpenAPI Proxy Server

The model registry proxy server implementation follows a contract-first approach, where the contract is identified by [model-registry.yaml](api/openapi/model-registry.yaml) OpenAPI specification.
Expand Down
2 changes: 1 addition & 1 deletion csi/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ WORKDIR /
COPY --from=builder /modelregistry/csi/bin/mr-storage-initializer .
USER 65532:65532

ENTRYPOINT ["/mr-storage-initializer"]
ENTRYPOINT ["/mr-storage-initializer"]
26 changes: 6 additions & 20 deletions csi/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# Useful paths
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
PROJECT_BIN := $(PROJECT_PATH)/bin
GO := $(PROJECT_BIN)/go1.21.9

# add tools bin directory
PATH := $(PROJECT_BIN):$(PATH)
GO ?= "$(shell which go)"

# container tool
DOCKER ?= docker
Expand All @@ -32,33 +25,26 @@ help: ## Display this help.

##@ Development

bin-go: ## Install go tool
GOBIN=$(PROJECT_BIN) go install golang.org/dl/go1.21.9@latest
$(PROJECT_BIN)/go1.21.9 download

.PHONY: bin
bin: bin-go ## Install required dependencies

.PHONY: tidy
tidy: ## Run go mod tidy.
${GO} mod tidy

.PHONY: fmt
fmt: bin ## Run go fmt against code.
fmt: ## Run go fmt against code.
${GO} fmt ./...

.PHONY: vet
vet: bin ## Run go vet against code.
vet: ## Run go vet against code.
${GO} vet ./...

.PHONY: test
test: fmt vet bin ## Run tests.
test: fmt vet ## Run tests.
${GO} test ./... -coverprofile cover.out

##@ Build

.PHONY: build
build: fmt vet bin ## Build binary.
build: fmt vet ## Build binary.
${GO} build -o bin/mr-storage-initializer main.go

.PHONY: run
Expand All @@ -75,4 +61,4 @@ docker-build-dev: ## Build container image using local model-registry module.

.PHONY: docker-push
docker-push: ## Push container image.
${DOCKER} push ${IMG}:$(IMG_VERSION)
${DOCKER} push ${IMG}:$(IMG_VERSION)

0 comments on commit 938d68e

Please sign in to comment.