1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Improvement] Parametrize Make tools (#1167)

This commit is contained in:
Adam Janikowski 2022-11-03 03:03:37 +01:00 committed by GitHub
parent 1ced857405
commit 203ee10a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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