-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjustfile
204 lines (159 loc) · 5.63 KB
/
justfile
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
set shell := ["bash", "-uc"]
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
GIT_COMMIT := `git rev-parse --verify --short HEAD`
# help
help:
@just --list
# build
build:
@cargo build --release
# cli controller run
cli-controller-run:
@cargo run -- controller run
# cli crd generate
cli-crd-generate:
@cargo run -- crd generate --format helm --output ./charts/tor-operator/templates
@cargo run -- crd generate --format yaml --output ./docs/custom_resource_definitions
# kube example onion key
cli-onion-key-generate-example:
@{{ if path_exists("./example/secrets/onionkey") == "true" { "" } else { "mkdir -p ./example/secrets/onionkey" } }}
@{{ if path_exists("./example/secrets/onionkey/hostname") == "true" { "" } else { "cargo run -- onion-key generate --output ./example/secrets/onionkey" } }}
@{{ if path_exists("./example/secrets/onionkey/hs_ed25519_public_key") == "true" { "" } else { "cargo run -- onion-key generate --output ./example/secrets/onionkey" } }}
@{{ if path_exists("./example/secrets/onionkey/hs_ed25519_secret_key") == "true" { "" } else { "cargo run -- onion-key generate --output ./example/secrets/onionkey" } }}
# cli markdown generate
cli-markdown-generate:
@cargo run -- markdown generate --output ./docs/cli_help.md
# cli onion key generate
cli-onion-key-generate:
@cargo run -- onion-key generate
# docker build
docker-build: docker-build-onion-balance docker-build-tor docker-build-tor-operator
# docker buildx build
docker-buildx-build: docker-buildx-build-onion-balance docker-buildx-build-tor docker-buildx-build-tor-operator
# docker build onion balance
docker-build-onion-balance:
docker build \
--tag agabani/onion-balance:{{GIT_COMMIT}} \
./containers/onion-balance
# docker buildx build onion balance
docker-buildx-build-onion-balance:
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag agabani/onion-balance:{{GIT_COMMIT}} \
./containers/onion-balance
# docker build tor
docker-build-tor:
docker build \
--tag agabani/tor:{{GIT_COMMIT}} \
./containers/tor
# docker buildx build tor
docker-buildx-build-tor:
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag agabani/tor:{{GIT_COMMIT}} \
./containers/tor
# docker build tor-operator
docker-build-tor-operator:
docker build \
--tag agabani/tor-operator:{{GIT_COMMIT}} \
.
# docker buildx build tor-operator
docker-buildx-build-tor-operator:
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag agabani/tor-operator:{{GIT_COMMIT}} \
.
# docker load
docker-load: docker-load-onion-balance docker-load-tor docker-load-tor-operator
# docker load onion balance
docker-load-onion-balance:
@docker load --input agabani-onion-balance.tar
# docker load tor
docker-load-tor:
@docker load --input agabani-tor.tar
# docker load tor-operator
docker-load-tor-operator:
@docker load --input agabani-tor-operator.tar
# docker run onion balance
docker-run-onion-balance: docker-build-onion-balance
@docker run --rm agabani/onion-balance:{{GIT_COMMIT}}
# docker run tor
docker-run-tor: docker-build-tor
@docker run --rm agabani/tor:{{GIT_COMMIT}}
# docker run tor-operator
docker-run-tor-operator: docker-build-tor-operator
@docker run --rm agabani/tor-operator:{{GIT_COMMIT}}
# docker save
docker-save: docker-save-onion-balance docker-save-tor docker-save-tor-operator
# docker save onion balance
docker-save-onion-balance:
@docker save --output agabani-onion-balance.tar agabani/onion-balance:{{GIT_COMMIT}}
# docker save tor
docker-save-tor:
@docker save --output agabani-tor.tar agabani/tor:{{GIT_COMMIT}}
# docker save tor-operator
docker-save-tor-operator:
@docker save --output agabani-tor-operator.tar agabani/tor-operator:{{GIT_COMMIT}}
# generate
generate: cli-crd-generate cli-markdown-generate license
# kube clean
kube-clean:
@tilt down
# kube load
kube-load:
@kind load docker-image agabani/onion-balance:{{GIT_COMMIT}} agabani/tor:{{GIT_COMMIT}} agabani/tor-operator:{{GIT_COMMIT}}
# kube port-forward dashboard
kube-port-forward-dashboard:
@kubectl -n kubernetes-dashboard port-forward services/kubernetes-dashboard 8443:443
# kube port-forward dashboard token
kube-port-forward-dashboard-token:
@kubectl -n kubernetes-dashboard create token admin-user
# kube port-forward jaeger
kube-port-forward-jaeger:
@kubectl -n jaeger port-forward service/jaeger-query 16686:16686
# kube port-forward hotrod
kube-port-forward-jaeger-hotrod:
@kubectl -n jaeger port-forward service/jaeger-hotrod 16680:80
# kube run
kube-run: cli-onion-key-generate-example
@tilt up
# kube test
kube-test:
@helm upgrade tor-operator ./charts/tor-operator/ \
--create-namespace \
--install \
--namespace tor-operator \
--set onionBalance.image.repository=agabani/onion-balance \
--set onionBalance.image.tag={{GIT_COMMIT}} \
--set tor.image.repository=agabani/tor \
--set tor.image.tag={{GIT_COMMIT}} \
--set image.repository=agabani/tor-operator \
--set image.tag={{GIT_COMMIT}}
@helm test tor-operator --namespace tor-operator --timeout 15m0s
# license
license:
@cargo bundle-licenses --format yaml --output docs/licenses/third_party.yaml
# lint
lint:
@cargo clippy
# mkdocs build
mkdocs-build:
@mkdocs build
# mkdocs install
mkdocs-install:
@pip3 install mkdocs
@pip3 install mkdocs-include-markdown-plugin
# mkdocs serve
mkdocs-serve:
@mkdocs serve
# release dryrun
release-dryrun version: generate
@cargo release {{version}}
# release execute
release-execute version: generate
@cargo release {{version}} --execute --no-publish
# test unit
test-unit:
@cargo test
# test e2e
test-e2e: docker-build kube-load kube-test