Skip to content

Commit

Permalink
#142 Update makefiles and include k8s-dogu targets
Browse files Browse the repository at this point in the history
  • Loading branch information
jelemux committed Jun 10, 2024
1 parent 08164af commit fed2f0c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,4 @@ app/.project
**/target/**
**/build/tmp/**
.npmrc
.bin/
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion build/make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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?=
Expand Down
2 changes: 1 addition & 1 deletion build/make/k8s-component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion build/make/k8s-crd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions build/make/k8s-dogu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."
4 changes: 2 additions & 2 deletions build/make/k8s.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
2 changes: 1 addition & 1 deletion build/make/mocks.mk
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
6 changes: 3 additions & 3 deletions build/make/static-analysis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fed2f0c

Please sign in to comment.