forked from r2dedios/regional-resiliency-pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1.24 KB
/
Makefile
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
# Copyright (c) 2023 Red Hat, Inc.
################################################
###### Regional DR Trigger Operator Chart ######
################################################
LOCALBIN = $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
OS=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)
BIN_CURL ?= curl
BIN_YQ ?= yq
BIN_HELM ?= $(LOCALBIN)/helm
VERSION_HELM = v3.14.0
OPERATOR_REPO ?= https://github.com/RHEcosystemAppEng/regional-dr-trigger-operator
OPERATOR_BRANCH =? main
CHART_VERSION ?= $(shell $(BIN_YQ) '.version' Chart.yaml)
TEMP_FOLDER = operator_tmp # ignored by git
.PHONY: lint
lint: $(BIN_HELM)
$(BIN_HELM) lint .
.PHONY: package
package: $(BIN_HELM)
$(BIN_HELM) package .
.PHONY: test
test: $(BIN_HELM)
$(BIN_HELM) template . > /dev/null
.PHONY: install
install: $(BIN_HELM)
$(BIN_HELM) install --generate-name .
.PHONY: generate
generate:
rm -rf $(TEMP_FOLDER)
git clone --branch $(OPERATOR_BRANCH) $(OPERATOR_REPO) $(TEMP_FOLDER)
cd $(TEMP_FOLDER) && $(MAKE) generate/chart CHART_VERSION=$(CHART_VERSION) CHART_TARGET=$(PWD)
rm -rf $(TEMP_FOLDER)
$(BIN_HELM): $(LOCALBIN)
$(BIN_CURL) -sSL https://get.helm.sh/helm-$(VERSION_HELM)-$(OS)-$(ARCH).tar.gz | tar xzf - -C $(LOCALBIN) --strip-components=1 --wildcards '*/helm'