From 349691bad9894cb6e70fefe1712fb995889b31fe Mon Sep 17 00:00:00 2001 From: rjanakiraman Date: Thu, 20 Oct 2022 17:47:09 +0530 Subject: [PATCH] NPT-560 Currently build_gqlgen and build_nexus-openapigen fails due to hardcoded path for in_container in build_gqlgen and build_openapigen GOBIN is hardcoded to use PKG_NAME/cmd in which PKG_NAME is default to /go/src.. for _in_container methods removing the dependency for PKG_NAME and changing to use PWD instead of PKG_NAME and migrate to COMPILER_DIR_NAME --- .gitignore | 1 + compiler/Makefile | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index f9725e80e..ab9afafa3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ coverage*.out cmd/nexus-sdk/nexus-sdk cmd/nexus-openapi-gen +cmd/gqlgen compiler.tar _generated diff --git a/compiler/Makefile b/compiler/Makefile index 02c9ea973..1c41bd403 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -13,31 +13,29 @@ TAG ?= $(shell git rev-parse --verify --short=8 HEAD) BUILDER_NAME ?= ${IMAGE_NAME}-builder BUILDER_TAG := $(shell md5sum builder/Dockerfile | awk '{ print $1 }' | head -c 8) -PKG_NAME?=/go/src/github.com/vmware-tanzu/graph-framework-for-microservices/${GO_PROJECT_NAME} +COMPILER_DIR_NAME?=/go/src/github.com/vmware-tanzu/graph-framework-for-microservices/${GO_PROJECT_NAME} +GOBIN?=${PWD}/cmd DATAMODEL_PATH ?= datamodel CONFIG_FILE ?= "" GENERATED_OUTPUT_DIRECTORY ?= generated -NEXUS_KUBEOPENAPI_VERSION ?= 7416bd4754d3c0dd8b3fa37fff53d36594f11607 -NEXUS_GRAPHQLGEN_VERSION ?= 32f028bce22efeb70b47a640195bd969dbb337f0 - ifeq ($(CONTAINER_ID),) define run_in_container docker run \ --volume $(realpath .)/..:/go/src/github.com/vmware-tanzu/graph-framework-for-microservices/ \ --volume ~/.ssh:/root/.ssh \ --network=host \ - --workdir ${PKG_NAME} \ + --workdir ${COMPILER_DIR_NAME} \ "${BUILDER_NAME}:${BUILDER_TAG}" /bin/bash -c "${1}" endef else define run_in_container docker run \ --volumes-from ${CONTAINER_ID} \ - --workdir ${PKG_NAME} \ + --workdir ${COMPILER_DIR_NAME} \ --env CICD_TOKEN=${CICD_TOKEN} \ - --env PKG_NAME=${PKG_NAME} \ + --env COMPILER_DIR_NAME=${COMPILER_DIR_NAME} \ "${BUILDER_NAME}:${BUILDER_TAG}" /bin/bash -c "${1}" endef endif @@ -83,13 +81,15 @@ build_openapigen_in_container: .PHONY: build_openapigen build_openapigen: - GOBIN=${PKG_NAME}/cmd go install ../kube-openapi/cmd/nexus-openapi-gen + GOBIN=$(GOBIN) go install ../kube-openapi/cmd/nexus-openapi-gen + @echo "----export PATH=$$PATH:$(GOBIN) if running locally---" build_gqlgen_in_container: $(call run_in_container,make build_gqlgen) build_gqlgen: - GOBIN=${PKG_NAME}/cmd go install ../gqlgen + GOBIN=$(GOBIN) go install ../gqlgen + @echo "----export PATH=$$PATH:$(GOBIN) if running locally---" .PHONY: unit-test unit-test: