-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (47 loc) · 3.12 KB
/
Makefile
File metadata and controls
56 lines (47 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
KUSTOMIZE ?= kustomize
OPERATOR_SDK ?= operator-sdk
VERSION ?= $(shell hack/git-semver.py)
UPSTREAM_REF ?= v$(VERSION)
CHANNELS ?= dev
.PHONY: out/static-deployment.yaml
out/static-deployment.yaml:
mkdir -p out
$(KUSTOMIZE) build ./deploy/default > out/static-deployment.yaml
out/image.list: out/static-deployment.yaml
hack/get-image-list.py out/static-deployment.yaml > out/image.list
.PHONY: deploy/manifests/related-images.yaml
deploy/manifests/related-images.yaml:
$(KUSTOMIZE) build deploy/manifests --load-restrictor LoadRestrictionsNone \
| hack/keep-and-replace-for-openshift.py \
| hack/get-image-list.py /dev/stdin --print-component \
| hack/get-related-images.sh > $@
.PHONY: snyc-chart
sync-chart:
KUSTOMIZE=$(KUSTOMIZE) hack/copy-image-config-to-chart.sh > charts/linstor-operator/templates/config.yaml
hack/crd-charts-copy.sh > charts/linstor-operator/templates/crds.yaml
sed -e 's/piraeus-operator/linstor-operator/' piraeus-operator/charts/piraeus/templates/rbac.yaml > charts/linstor-operator/templates/rbac.yaml
.PHONY: bundle
bundle: deploy/manifests/related-images.yaml
rm -rf bundle
$(KUSTOMIZE) build deploy/manifests --load-restrictor LoadRestrictionsNone \
| hack/keep-and-replace-for-openshift.py \
| hack/replace-image-tags.py deploy/manifests/related-images.yaml \
| $(OPERATOR_SDK) generate bundle --channels $(CHANNELS) -q --overwrite --version $(VERSION)
# Add related images information
yq -ie '.spec.relatedImages = load("deploy/manifests/related-images.yaml")' bundle/manifests/linstor-operator.clusterserviceversion.yaml
yq -ie '.spec.install.spec.deployments[0].spec.template.spec.containers[0].env += (load("deploy/manifests/related-images.yaml") | map({"name": "RELATED_IMAGE_\(.name)", "value": .image}))' bundle/manifests/linstor-operator.clusterserviceversion.yaml
# These should really exist automatically, but don't. https://github.com/operator-framework/operator-sdk/pull/5560
yq -ie '.annotations["com.redhat.openshift.versions"] = load("bundle/manifests/linstor-operator.clusterserviceversion.yaml").metadata.annotations["com.redhat.openshift.versions"]' bundle/metadata/annotations.yaml
yq -ie '.metadata.annotations["containerImage"] = (load("deploy/manifests/related-images.yaml") | filter(.name == "manager_linstor-operator")[0].image)' bundle/manifests/linstor-operator.clusterserviceversion.yaml
.PHONY: release
release:
git -C piraeus-operator fetch && git -C piraeus-operator checkout $(UPSTREAM_REF)
$(MAKE) sync-chart
hack/image-updates.sh
yq -ie '.version = "$(VERSION)" | .appVersion = "v$(VERSION)"' charts/linstor-operator/Chart.yaml
cd deploy/default && $(KUSTOMIZE) edit set image controller=drbd.io/linstor-operator:v$(VERSION)
cd deploy/manifests/operator && $(KUSTOMIZE) edit set image controller=drbd.io/linstor-operator:v$(VERSION)
git add piraeus-operator charts/linstor-operator/templates/config.yaml charts/linstor-operator/templates/crds.yaml charts/linstor-operator/Chart.yaml deploy/default/kustomization.yaml deploy/manifests/operator/kustomization.yaml
git diff --staged
@echo git commit -svm \"Release $(VERSION)\"
@echo git tag -sm \"Release $(VERSION)\" v$(VERSION)