-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline.sh
More file actions
executable file
·63 lines (53 loc) · 1.45 KB
/
pipeline.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.45 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
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export ROS2_IMAGE="${ROS2_IMAGE:-ros2-jazzy-alpine:latest}"
BLUE='\033[0;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
info() { printf "${BLUE}[INFO]${NC} %s\n" "$1"; }
success() { printf "${GREEN}[OK]${NC} %s\n" "$1"; }
error() { printf "${RED}[ERR]${NC} %s\n" "$1"; }
show_help() {
cat <<EOF
Usage: $0 [OPTIONS]
ROS 2 Jazzy Alpine build pipeline.
Options:
--build-only Build without testing
--test-only Test existing image (skip build)
--clean Clean cache and rebuild
--info Show system information
--help Show this help
Environment:
ROS2_IMAGE Image name (default: ros2-jazzy-alpine:latest)
EOF
}
case "${1:-}" in
--help|-h)
show_help
;;
--info)
"$SCRIPT_DIR/build.sh" --info
;;
--build-only)
"$SCRIPT_DIR/build.sh"
;;
--test-only)
"$SCRIPT_DIR/test.sh" "$ROS2_IMAGE"
;;
--clean)
"$SCRIPT_DIR/build.sh" --clean
"$SCRIPT_DIR/test.sh" "$ROS2_IMAGE"
;;
*)
info "Starting pipeline: build + test"
start_time=$(date +%s)
"$SCRIPT_DIR/build.sh"
"$SCRIPT_DIR/test.sh" "$ROS2_IMAGE"
duration=$(( $(date +%s) - start_time ))
hours=$((duration / 3600))
mins=$(((duration % 3600) / 60))
success "Pipeline completed in ${hours}h ${mins}m"
;;
esac