-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
51 lines (40 loc) · 1.67 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
SHELL := /bin/bash
LATEST_TAG := $(shell git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1))
define bundle_release
@echo ""
if [[ "$(1)" == *"windows"* ]]; then \
tar -czvf ./target/$(1)/release/kubesess_$(1).tar.gz scripts/ ./target/$(1)/release/kubesess.exe; \
else \
tar -czvf ./target/$(1)/release/kubesess_$(1).tar.gz scripts/ ./target/$(1)/release/kubesess; \
fi
endef
.PHONY: run
run:
cargo run -- -v docker-desktop context
.PHONY: build
build:
cargo build --release
.PHONY: clean
clean:
rm -r -f $$HOME/.kube/kubesess
sudo rm -r -f /usr/local/bin/kubesess
.PHONY: bundle_release
bundle_release:
$(call bundle_release,${TARGET})
.PHONY: deploy_local
deploy_local: clean build
mkdir -p $$HOME/.kube/kubesess/scripts/sh
cp ./target/release/kubesess ~/.kube/kubesess
cp ./scripts/sh/completion.sh ./scripts/sh/kubesess.sh ~/.kube/kubesess/scripts/sh
sudo mv ~/.kube/kubesess/kubesess /usr/local/bin/kubesess
source ~/.kube/kubesess/scripts/sh/kubesess.sh
source ~/.kube/kubesess/scripts/sh/completion.sh
.PHONY: benchmark
benchmark: deploy_local
sh ./benches/benchmark.sh
hyperfine --warmup 5 --runs 10 --shell none 'kubesess -v docker-desktop context' 'kubectx docker-desktop' --export-markdown ./benches/hyperfine/context-markdown-kubectx.md
hyperfine --warmup 5 --runs 10 --shell none 'kubesess -v docker-desktop context' 'kubie ctx docker-desktop' --export-markdown ./benches/hyperfine/context-markdown-kubie.md
.PHONY: benchmark-ns
benchmark-ns: deploy_local
sh ./benches/benchmark.sh
hyperfine --warmup 5 --runs 10 --shell none 'kubesess -v monitoring namespace' 'kubens monitoring' --export-markdown ./benches/hyperfine/namespace-markdown.md