Skip to content

Commit b5e7b14

Browse files
authored
CLOUD-833 - Add release and after-release targets to Makefile (#1495)
1 parent 90de960 commit b5e7b14

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ $(DEPLOYDIR)/crd.yaml: kustomize generate
1818
$(KUSTOMIZE) build config/crd/ > $(DEPLOYDIR)/crd.yaml
1919
cp $(DEPLOYDIR)/crd.yaml ./e2e-tests/version-service/conf/crd.yaml
2020

21+
.PHONY: $(DEPLOYDIR)/operator.yaml
22+
$(DEPLOYDIR)/operator.yaml:
23+
sed -i "/^ containers:/,/^ image:/{s#image: .*#image: $(IMAGE_TAG_BASE):$(VERSION)#}" deploy/operator.yaml
24+
25+
.PHONY: $(DEPLOYDIR)/cw-operator.yaml
26+
$(DEPLOYDIR)/cw-operator.yaml:
27+
sed -i "/^ containers:/,/^ image:/{s#image: .*#image: $(IMAGE_TAG_BASE):$(VERSION)#}" deploy/cw-operator.yaml
28+
2129
$(DEPLOYDIR)/bundle.yaml: $(DEPLOYDIR)/crd.yaml $(DEPLOYDIR)/rbac.yaml $(DEPLOYDIR)/operator.yaml ## Generate deploy/bundle.yaml
2230
cat $(DEPLOYDIR)/crd.yaml > $(DEPLOYDIR)/bundle.yaml; echo "---" >> $(DEPLOYDIR)/bundle.yaml; cat $(DEPLOYDIR)/rbac.yaml >> $(DEPLOYDIR)/bundle.yaml; echo "---" >> $(DEPLOYDIR)/bundle.yaml; cat $(DEPLOYDIR)/operator.yaml >> $(DEPLOYDIR)/bundle.yaml
2331

@@ -72,3 +80,31 @@ controller-gen: ## Download controller-gen locally if necessary.
7280
KUSTOMIZE = $(shell pwd)/bin/kustomize
7381
kustomize: ## Download kustomize locally if necessary.
7482
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
83+
84+
# Prepare release
85+
CERT_MANAGER_VER := $(shell grep -Eo "cert-manager v.*" go.mod|grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")
86+
release: manifests
87+
sed -i "/CERT_MANAGER_VER/s/CERT_MANAGER_VER=\".*/CERT_MANAGER_VER=\"$(CERT_MANAGER_VER)\"/" e2e-tests/functions
88+
sed -i \
89+
-e "s/crVersion: .*/crVersion: $(VERSION)/" \
90+
-e "/^spec:/,/^ image:/{s#image: .*#image: percona/percona-server-mongodb:@@SET_TAG@@#}" deploy/cr-minimal.yaml
91+
sed -i \
92+
-e "s/crVersion: .*/crVersion: $(VERSION)/" \
93+
-e "/^spec:/,/^ image:/{s#image: .*#image: percona/percona-server-mongodb:@@SET_TAG@@#}" \
94+
-e "/^ backup:/,/^ image:/{s#image: .*#image: percona/percona-backup-mongodb:@@SET_TAG@@#}" \
95+
-e "/^ pmm:/,/^ image:/{s#image: .*#image: percona/pmm-client:@@SET_TAG@@#}" deploy/cr.yaml
96+
97+
# Prepare main branch after release
98+
MAJOR_VER := $(shell grep -oE "crVersion: .*" deploy/cr.yaml|grep -oE "[0-9]+\.[0-9]+\.[0-9]+"|cut -d'.' -f1)
99+
MINOR_VER := $(shell grep -oE "crVersion: .*" deploy/cr.yaml|grep -oE "[0-9]+\.[0-9]+\.[0-9]+"|cut -d'.' -f2)
100+
NEXT_VER ?= $(MAJOR_VER).$$(($(MINOR_VER) + 1)).0
101+
after-release: manifests
102+
sed -i "/Version = \"/s/Version = \".*/Version = \"$(NEXT_VER)\"/" version/version.go
103+
sed -i \
104+
-e "s/crVersion: .*/crVersion: $(NEXT_VER)/" \
105+
-e "/^spec:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-mongod6.0#}" deploy/cr-minimal.yaml
106+
sed -i \
107+
-e "s/crVersion: .*/crVersion: $(NEXT_VER)/" \
108+
-e "/^spec:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-mongod6.0#}" \
109+
-e "/^ backup:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-backup#}" \
110+
-e "/^ pmm:/,/^ image:/{s#image: .*#image: perconalab/pmm-client:dev-latest#}" deploy/cr.yaml

0 commit comments

Comments
 (0)