forked from cosmology-tech/starship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (67 loc) · 2.75 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Set helm args based on only file to show
HELM_NAME = starship
HELM_CHART = devnet
ifneq ($(FILE),)
HELM_ARGS += --show-only $(FILE)
endif
KEYS_CONFIG = charts/$(HELM_CHART)/configs/keys.json
VALUES_FILE = charts/$(HELM_CHART)/values.yaml
###############################################################################
### Helm commands ###
###############################################################################
all: delete install
debug:
helm template --dry-run --debug --generate-name ./charts/$(HELM_CHART) -f $(VALUES_FILE) $(HELM_ARGS)
install:
helm install --replace --debug $(HELM_NAME) ./charts/$(HELM_CHART) -f $(VALUES_FILE) $(HELM_ARGS)
upgrade:
helm upgrade --debug $(HELM_NAME) ./charts/$(HELM_CHART) -f $(VALUES_FILE) $(HELM_ARGS)
test:
helm test --debug $(HELM_NAME)
delete:
-helm delete --debug $(HELM_NAME)
###############################################################################
### Local Kind Setup ###
###############################################################################
KIND_CLUSTER=starship
.PHONY: check
check:
bash $(CURDIR)/scripts/dev-setup.sh
.PHONY: setup
setup: setup-kind
.PHONY: clean
clean: clean-kind
.PHONY: setup-kind
setup-kind:
kind create cluster --name $(KIND_CLUSTER)
.PHONY: clean-kind
clean-kind:
kind delete cluster --name $(KIND_CLUSTER)
###############################################################################
### Keys config ###
###############################################################################
# Helper scripts to play with the keys
# Requires a chain binary to be installed locally
# one of validators, keys, relayers
TYPE = relayers
N = 1
number = $(shell jq '.$(TYPE) | length + 1' $(KEYS_CONFIG))
name = $(shell echo $(shell jq '.$(TYPE)[0].name' $(KEYS_CONFIG) | sed 's/[0-9]//'))$(number)
mnemonic = $(shell gaiad keys add rly --keyring-backend test --dry-run --output json 2>&1 | jq -r ".mnemonic")
add-mnemonic:
@jq '.$(TYPE) += [{"name": "$(name)", "type": "local", "mnemonic": "$(mnemonic)"}]' $(KEYS_CONFIG) >> $(KEYS_CONFIG).temp
@mv $(KEYS_CONFIG).temp $(KEYS_CONFIG)
jq -r '.$(TYPE) | last' $(KEYS_CONFIG)
add-n-mnemonic:
i=1; while [ "$$i" -le $(N) ]; do \
$(MAKE) add-mnemonic; i=$$((i + 1));\
done
###############################################################################
### Port forward ###
###############################################################################
.PHOY: port-forward-all
port-forward-all:
$(CURDIR)/scripts/port-forward.sh --config=$(VALUES_FILE)
.PHONY: stop-forward
stop-forward:
-pkill -f "port-forward"