forked from replicatedhq/replicated-starter-ship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
106 lines (86 loc) · 3.38 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.PHONY: install-ship run-local run-local-headless lint clean-assets print-generated-assets deploy deps-lint
SHIP := $(shell which ship)
REPO_PATH := $(shell pwd)
SHELL := /bin/bash
RELEASE_NOTES := "Automated release by ${USER} on $(shell date)"
lint_reporter := console
APPLIANCE_APP_ID := CHANGEME
APPLIANCE_CHANNEL := Unstable
SHIP_APP_ID := CHANGEME
SHIP_CHANNEL := Nightly
VERSION_TAG := "0.1.0-dev-${USER}"
# Replace this with your private or public ship repo in github
REPO := replicatedhq/replicated-starter-ship
# App name will be displayed in the ship console
APP_NAME := "My Cool App"
ICON := "https://vendor.replicated.com/011a5f1125bce80a8ced6fae0c409c91.png"
install-ship:
brew install ship
deps-lint:
@[ -x `npm bin`/replicated-lint ] || npm install --no-save replicated-lint
deps-vendor-cli:
@if [[ -x deps/replicated ]]; then exit 0; else \
echo '-> Downloading Replicated CLI... '; \
mkdir -p deps/; \
if [[ "`uname`" == "Linux" ]]; then curl -fsSL https://github.com/replicatedhq/replicated/releases/download/v0.9.0/replicated_0.9.0_linux_amd64.tar.gz | tar xvz -C deps; exit 0; fi; \
if [[ "`uname`" == "Darwin" ]]; then curl -fsSL https://github.com/replicatedhq/replicated/releases/download/v0.9.0/replicated_0.9.0_darwin_amd64.tar.gz | tar xvz -C deps; exit 0; fi; fi;
lint-appliance: deps-lint
`npm bin`/replicated-lint validate -f replicated.yaml --reporter $(lint_reporter)
lint-ship: deps-lint
`npm bin`/replicated-lint validate --project replicatedShip -f ship.yaml --reporter $(lint_reporter)
lint: lint-appliance lint-ship
release-appliance: clean-assets lint-appliance deps-vendor-cli
mkdir -p tmp
kustomize build overlays/appliance | awk '/---/{print;print "# kind: scheduler-kubernetes";next}1' > tmp/k8s.yaml
cat replicated.yaml tmp/k8s.yaml | deps/replicated release create \
--app $(APPLIANCE_APP_ID) \
--yaml - \
--promote $(APPLIANCE_CHANNEL) \
--version $(VERSION_TAG) \
--release-notes $(RELEASE_NOTES)
release-ship: clean-assets lint-ship deps-vendor-cli
cat ship.yaml | deps/replicated release create \
--app $(SHIP_APP_ID) \
--yaml - \
--promote $(SHIP_CHANNEL) \
--version $(VERSION_TAG) \
--release-notes $(RELEASE_NOTES)
run-local: clean-assets lint-ship
mkdir -p tmp
cd tmp && \
$(SHIP) app \
--runbook $(REPO_PATH)/ship.yaml \
--set-github-contents $(REPO):/base:master:$(REPO_PATH) \
--set-github-contents $(REPO):/scripts:master:$(REPO_PATH) \
--set-channel-icon $(ICON) \
--set-channel-name $(APP_NAME) \
--log-level=off
@$(MAKE) print-generated-assets
run-local-headless: clean-assets lint-ship
mkdir -p tmp
cd tmp && \
$(SHIP) app \
--runbook $(REPO_PATH)/ship.yaml \
--set-github-contents $(REPO):/base:master:$(REPO_PATH) \
--set-github-contents $(REPO):/scripts:master:$(REPO_PATH) \
--headless \
--log-level=error
@$(MAKE) print-generated-assets
deploy-ship:
@echo
@echo ┌─────────────┐
@echo "│ Deploying │"
@echo └─────────────┘
@echo
@sleep .5
kubectl apply -f tmp/rendered.yaml
print-generated-assets:
@echo
@echo ┌────────────────────┐
@echo "│ Generated Assets │"
@echo └────────────────────┘
@echo
@sleep .5
@find tmp -maxdepth 3 -type file
clean-assets:
rm -rf tmp/*