Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·90 lines (77 loc) · 2.16 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·90 lines (77 loc) · 2.16 KB
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
#!/bin/bash
# Kubeowler build and run script
set -e
echo "🔍 Kubeowler - Kubernetes Cluster Checker"
echo "========================================="
# Check Rust environment
if ! command -v cargo &> /dev/null; then
echo "❌ Error: Cargo (Rust package manager) not found"
echo ""
echo "Please install Rust first:"
echo "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
echo "source ~/.cargo/env"
exit 1
fi
echo "✅ Rust environment found"
echo " - Rust version: $(rustc --version)"
echo " - Cargo version: $(cargo --version)"
echo ""
# Check project files
if [ ! -f "Cargo.toml" ]; then
echo "❌ Error: Cargo.toml not found"
echo "Please run this script from the project root directory"
exit 1
fi
echo "✅ Project files OK"
echo ""
# Build project
echo "🔧 Building project..."
if [ "$1" = "--release" ]; then
echo " Build mode: release"
cargo build --release
BINARY_PATH="./target/release/kubeowler"
else
echo " Build mode: debug"
cargo build
BINARY_PATH="./target/debug/kubeowler"
fi
if [ $? -eq 0 ]; then
echo "✅ Build succeeded!"
echo ""
# Show binary info
if [ -f "$BINARY_PATH" ]; then
echo "📦 Binary:"
echo " Path: $BINARY_PATH"
echo " Size: $(du -h $BINARY_PATH | cut -f1)"
echo ""
# Usage examples
echo "🚀 Usage examples:"
echo " # Show help"
echo " $BINARY_PATH check --help"
echo ""
echo " # Full cluster check"
echo " $BINARY_PATH check"
echo ""
echo " # Specific namespace"
echo " $BINARY_PATH check -n kube-system"
echo ""
echo " # Custom output file and format"
echo " $BINARY_PATH check -o my-report.md"
echo " $BINARY_PATH check -o report.json -f json"
echo ""
fi
else
echo "❌ Build failed"
exit 1
fi
# Run tests
if [ "$2" = "--test" ]; then
echo "🧪 Running tests..."
cargo test
if [ $? -eq 0 ]; then
echo "✅ All tests passed!"
else
echo "❌ Some tests failed"
fi
fi
echo "🎉 Done! You can now run Kubeowler to check your cluster."