diff --git a/CHANGELOG.md b/CHANGELOG.md index bfbc3f2b0..e27c23e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - (Refactoring) Extract Inspector Definitions package - (Bugfix) Fix PDBs Version discovery - (Feature) Agency ArangoSync State check +- (Improvement) Parametrize Make tools ## [1.2.20](https://github.com/arangodb/kube-arangodb/tree/1.2.20) (2022-10-25) - (Feature) Add action progress diff --git a/Makefile b/Makefile index 73910ae25..cce8f3a27 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ CURRENT=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) ROOT:=$(CURRENT) +SED ?= sed +REALPATH ?= realpath + PROJECT := arangodb_operator SCRIPTDIR := $(shell pwd) ROOTDIR := $(shell cd $(SCRIPTDIR) && pwd) @@ -279,7 +282,7 @@ update-generated: @rm -fr $(ORGDIR) @mkdir -p $(ORGDIR) @ln -s -f $(SCRIPTDIR) $(ORGDIR)/kube-arangodb - @sed -e 's/^/\/\/ /' -e 's/ *$$//' $(ROOTDIR)/tools/codegen/license-header.txt > $(ROOTDIR)/tools/codegen/boilerplate.go.txt + @$(SED) -e 's/^/\/\/ /' -e 's/ *$$//' $(ROOTDIR)/tools/codegen/license-header.txt > $(ROOTDIR)/tools/codegen/boilerplate.go.txt GOPATH=$(GOBUILDDIR) $(VENDORDIR)/k8s.io/code-generator/generate-groups.sh \ "all" \ "github.com/arangodb/kube-arangodb/pkg/generated" \ @@ -529,7 +532,7 @@ set-api-version/%: "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ - | xargs -n 1 sed -i "s#github.com/arangodb/kube-arangodb/pkg/apis/$*/v[A-Za-z0-9]\+#github.com/arangodb/kube-arangodb/pkg/apis/$*/v$(API_VERSION)#g" + | xargs -n 1 $(SED) -i "s#github.com/arangodb/kube-arangodb/pkg/apis/$*/v[A-Za-z0-9]\+#github.com/arangodb/kube-arangodb/pkg/apis/$*/v$(API_VERSION)#g" @grep -rHn "DatabaseV[A-Za-z0-9]\+()" \ "$(ROOT)/pkg/deployment/" \ "$(ROOT)/pkg/replication/" \ @@ -540,7 +543,7 @@ set-api-version/%: "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ - | xargs -n 1 sed -i "s#DatabaseV[A-Za-z0-9]\+()\.#DatabaseV$(API_VERSION)().#g" + | xargs -n 1 $(SED) -i "s#DatabaseV[A-Za-z0-9]\+()\.#DatabaseV$(API_VERSION)().#g" @grep -rHn "ReplicationV[A-Za-z0-9]\+()" \ "$(ROOT)/pkg/deployment/" \ "$(ROOT)/pkg/replication/" \ @@ -551,12 +554,12 @@ set-api-version/%: "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ - | xargs -n 1 sed -i "s#ReplicationV[A-Za-z0-9]\+()\.#ReplicationV$(API_VERSION)().#g" + | xargs -n 1 $(SED) -i "s#ReplicationV[A-Za-z0-9]\+()\.#ReplicationV$(API_VERSION)().#g" synchronize-v2alpha1-with-v1: @rm -f pkg/apis/deployment/v1/zz_generated.deepcopy.go pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go - @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec realpath --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do if [ ! -d "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})" ]; then mkdir -p "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})"; fi; done - @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec realpath --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do cat "$(ROOT)/pkg/apis/deployment/v1/$${file}" | sed "s#package v1#package v2alpha1#g" | sed 's#ArangoDeploymentVersion = "v1"#ArangoDeploymentVersion = "v2alpha1"#g' > "$(ROOT)/pkg/apis/deployment/v2alpha1/$${file}"; done + @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec $(REALPATH) --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do if [ ! -d "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})" ]; then mkdir -p "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})"; fi; done + @for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec $(REALPATH) --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do cat "$(ROOT)/pkg/apis/deployment/v1/$${file}" | $(SED) "s#package v1#package v2alpha1#g" | $(SED) 's#ArangoDeploymentVersion = "v1"#ArangoDeploymentVersion = "v2alpha1"#g' > "$(ROOT)/pkg/apis/deployment/v2alpha1/$${file}"; done @make update-generated @make set-deployment-api-version-v2alpha1 bin @make set-deployment-api-version-v1 bin diff --git a/community.mk b/community.mk index c52aa7988..a4751a274 100644 --- a/community.mk +++ b/community.mk @@ -1,6 +1,6 @@ .PHONY: vendor-pre vendor-pre: - @sed -i "s#\tgithub.com/arangodb/rebalancer#\t// github.com/arangodb/rebalancer#g" "$(ROOT)/go.mod" + @$(SED) -i "s#\tgithub.com/arangodb/rebalancer#\t// github.com/arangodb/rebalancer#g" "$(ROOT)/go.mod" vendor: vendor-pre \ No newline at end of file