From fed2f0cc8b3e493b0ab43f1770d06844e469bddc Mon Sep 17 00:00:00 2001 From: Jeremias Weber Date: Mon, 10 Jun 2024 10:07:13 +0200 Subject: [PATCH] #142 Update makefiles and include k8s-dogu targets --- .gitignore | 1 + Makefile | 3 ++- build/make/build.mk | 2 +- build/make/k8s-component.mk | 2 +- build/make/k8s-crd.mk | 2 +- build/make/k8s-dogu.mk | 14 +++++++------- build/make/k8s.mk | 4 ++-- build/make/mocks.mk | 2 +- build/make/static-analysis.mk | 6 +++--- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 2ade773b..30afd6d1 100644 --- a/.gitignore +++ b/.gitignore @@ -490,3 +490,4 @@ app/.project **/target/** **/build/tmp/** .npmrc +.bin/ diff --git a/Makefile b/Makefile index 6b408c34..5a207e83 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,14 @@ ADDITIONAL_LDFLAGS="" NPM_REGISTRY_RELEASE=https://ecosystem.cloudogu.com/nexus/repository/npm-releases/ NPM_REGISTRY_RC=https://ecosystem.cloudogu.com/nexus/repository/npm-releasecandidates/ UI_SRC=app/src/main/ui -MAKEFILES_VERSION=9.0.1 +MAKEFILES_VERSION=9.0.5 .DEFAULT_GOAL:=default include build/make/variables.mk include build/make/self-update.mk include build/make/release.mk include build/make/bats.mk +include build/make/k8s-dogu.mk default: dogu-release diff --git a/build/make/build.mk b/build/make/build.mk index b102149b..857c11d4 100644 --- a/build/make/build.mk +++ b/build/make/build.mk @@ -3,7 +3,7 @@ ADDITIONAL_LDFLAGS?=-extldflags -static LDFLAGS?=-ldflags "$(ADDITIONAL_LDFLAGS) -X main.Version=$(VERSION) -X main.CommitID=$(COMMIT_ID)" GOIMAGE?=golang -GOTAG?=1.14.13 +GOTAG?=1.22 GOOS?=linux GOARCH?=amd64 PRE_COMPILE?= diff --git a/build/make/k8s-component.mk b/build/make/k8s-component.mk index 9d291839..eb5de62f 100644 --- a/build/make/k8s-component.mk +++ b/build/make/k8s-component.mk @@ -115,7 +115,7 @@ ${HELM_RELEASE_TGZ}: ${BINARY_HELM} ${HELM_TARGET_DIR}/Chart.yaml ${HELM_POST_GE .PHONY: helm-delete-existing-tgz helm-delete-existing-tgz: ## Remove an existing Helm package from the target directory. @echo "Delete ${HELM_RELEASE_TGZ}*" - @rm -f ${HELM_RELEASE_TGZ}* + @rm -f ${HELM_TARGET_DIR}/${ARTIFACT_ID}-*.tgz ##@ K8s - Helm lint targets diff --git a/build/make/k8s-crd.mk b/build/make/k8s-crd.mk index 4cbcd884..63c57406 100644 --- a/build/make/k8s-crd.mk +++ b/build/make/k8s-crd.mk @@ -74,7 +74,7 @@ crd-helm-package: crd-helm-delete-existing-tgz ${HELM_CRD_RELEASE_TGZ} ## Genera .PHONY: crd-helm-delete-existing-tgz crd-helm-delete-existing-tgz: ## Remove an existing Helm CRD package. - @rm -f ${HELM_CRD_RELEASE_TGZ}* + @rm -f ${HELM_CRD_TARGET_DIR}/${ARTIFACT_CRD_ID}-*.tgz ${HELM_CRD_RELEASE_TGZ}: ${BINARY_HELM} crd-helm-generate ## Generates and packages the Helm CRD chart. @echo "Package generated helm crd-chart" diff --git a/build/make/k8s-dogu.mk b/build/make/k8s-dogu.mk index 9c244a32..296b1c7a 100644 --- a/build/make/k8s-dogu.mk +++ b/build/make/k8s-dogu.mk @@ -3,15 +3,15 @@ DOGU_JSON_FILE=${WORKDIR}/dogu.json DOGU_JSON_DEV_FILE=${WORKDIR}/${TARGET_DIR}/dogu.json # Name of the dogu is extracted from the dogu.json -ARTIFACT_ID=$(shell $(BINARY_YQ) -e ".Name" $(DOGU_JSON_FILE) | sed "s|.*/||g") +ARTIFACT_ID=$(shell $(BINARY_YQ) -oy -e ".Name" $(DOGU_JSON_FILE) | sed "s|.*/||g") # Namespace of the dogu is extracted from the dogu.json -ARTIFACT_NAMESPACE=$(shell $(BINARY_YQ) -e ".Name" $(DOGU_JSON_FILE) | sed "s|/.*||g") +ARTIFACT_NAMESPACE=$(shell $(BINARY_YQ) -oy -e ".Name" $(DOGU_JSON_FILE) | sed "s|/.*||g") # Version of the dogu is extracted from the dogu.json -VERSION=$(shell $(BINARY_YQ) -e ".Version" $(DOGU_JSON_FILE)) +VERSION=$(shell $(BINARY_YQ) -oy -e ".Version" $(DOGU_JSON_FILE)) # Image of the dogu is extracted from the dogu.json -IMAGE=$(shell $(BINARY_YQ) -e ".Image" $(DOGU_JSON_FILE)):$(VERSION) -IMAGE_DEV_WITHOUT_TAG=$(shell $(BINARY_YQ) -e ".Image" $(DOGU_JSON_FILE) | sed "s|registry\.cloudogu\.com\(.\+\)|${K3CES_REGISTRY_URL_PREFIX}\1|g") -IMAGE_DEV=${IMAGE_DEV_WITHOUT_TAG}:${VERSION} +IMAGE=$(shell $(BINARY_YQ) -oy -e ".Image" $(DOGU_JSON_FILE)):$(VERSION) +IMAGE_DEV_WITHOUT_TAG=$(shell $(BINARY_YQ) -oy -e ".Image" $(DOGU_JSON_FILE) | sed "s|registry\.cloudogu\.com\(.\+\)|${K3CES_REGISTRY_URL_PREFIX}\1|g") +IMAGE_DEV=${IMAGE_DEV_WITHOUT_TAG} include $(BUILD_DIR)/make/k8s.mk @@ -44,6 +44,6 @@ apply-dogu-resource: .PHONY: install-dogu-descriptor install-dogu-descriptor: ${BINARY_YQ} $(TARGET_DIR) ## Installs a configmap with current dogu.json into the cluster. @echo "Generate configmap from dogu.json..." - @$(BINARY_YQ) ".Image=\"${IMAGE_DEV_WITHOUT_TAG}\"" ${DOGU_JSON_FILE} > ${DOGU_JSON_DEV_FILE} + @$(BINARY_YQ) -oj ".Image=\"${IMAGE_DEV_WITHOUT_TAG}\"" ${DOGU_JSON_FILE} > ${DOGU_JSON_DEV_FILE} @kubectl create configmap "$(ARTIFACT_ID)-descriptor" --from-file=$(DOGU_JSON_DEV_FILE) --dry-run=client -o yaml | kubectl apply -f - --namespace=${NAMESPACE} @echo "Done." diff --git a/build/make/k8s.mk b/build/make/k8s.mk index 0f9fe02a..9861c306 100644 --- a/build/make/k8s.mk +++ b/build/make/k8s.mk @@ -11,7 +11,7 @@ BINARY_YQ_4_VERSION?=v4.40.3 BINARY_HELM = $(UTILITY_BIN_PATH)/helm BINARY_HELM_VERSION?=v3.13.0 CONTROLLER_GEN = $(UTILITY_BIN_PATH)/controller-gen -CONTROLLER_GEN_VERSION?=v0.13.0 +CONTROLLER_GEN_VERSION?=v0.14.0 # 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. @@ -145,4 +145,4 @@ ENVTEST = $(UTILITY_BIN_PATH)/setup-envtest envtest: ${ENVTEST} ## Download envtest-setup locally if necessary. ${ENVTEST}: - $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest) \ No newline at end of file + $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest) diff --git a/build/make/mocks.mk b/build/make/mocks.mk index e3133693..4c9697f0 100644 --- a/build/make/mocks.mk +++ b/build/make/mocks.mk @@ -1,7 +1,7 @@ ##@ Mocking MOCKERY_BIN=${UTILITY_BIN_PATH}/mockery -MOCKERY_VERSION=v2.20.0 +MOCKERY_VERSION?=v2.42.1 MOCKERY_YAML=${WORKDIR}/.mockery.yaml ${MOCKERY_BIN}: ${UTILITY_BIN_PATH} diff --git a/build/make/static-analysis.mk b/build/make/static-analysis.mk index 70e64685..0ed0de33 100644 --- a/build/make/static-analysis.mk +++ b/build/make/static-analysis.mk @@ -2,14 +2,14 @@ STATIC_ANALYSIS_DIR=$(TARGET_DIR)/static-analysis GOIMAGE?=golang -GOTAG?=1.18 +GOTAG?=1.22 CUSTOM_GO_MOUNT?=-v /tmp:/tmp REVIEW_DOG=$(TMP_DIR)/bin/reviewdog LINT=$(TMP_DIR)/bin/golangci-lint -LINT_VERSION?=v1.49.0 +LINT_VERSION?=v1.58.2 # ignore tests and mocks -LINTFLAGS=--tests=false --skip-files="^.*_mock.go$$" --skip-files="^.*/mock.*.go$$" --timeout 10m --issues-exit-code 0 +LINTFLAGS=--tests=false --exclude-files="^.*_mock.go$$" --exclude-files="^.*/mock.*.go$$" --timeout 10m --issues-exit-code 0 ADDITIONAL_LINTER=-E bodyclose -E containedctx -E contextcheck -E decorder -E dupl -E errname -E forcetypeassert -E funlen -E unparam .PHONY: static-analysis