-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathprogress.sh
More file actions
executable file
·45 lines (35 loc) · 1.08 KB
/
progress.sh
File metadata and controls
executable file
·45 lines (35 loc) · 1.08 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
#!/bin/bash
set -euo pipefail
# Show recent commits on agent-work and running containers.
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
cat <<HELP
Usage: $0
Show recent commits on agent-work and running containers.
Clones the bare repo to a temp directory, displays the last
15 commits on agent-work, and lists running containers.
HELP
exit 0
fi
SWARM_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SWARM_DIR/lib/check-deps.sh"
check_deps git docker
REPO_ROOT="$(git rev-parse --show-toplevel)"
PROJECT="$(basename "$REPO_ROOT")"
BARE_REPO="/tmp/${PROJECT}-upstream.git"
CHECK_DIR="/tmp/${PROJECT}-progress-check"
if [ ! -d "$BARE_REPO" ]; then
echo "ERROR: ${BARE_REPO} not found. Are agents running?" >&2
exit 1
fi
cd /tmp
rm -rf "$CHECK_DIR"
git clone --quiet "$BARE_REPO" "$CHECK_DIR"
cd "$CHECK_DIR"
git checkout --quiet agent-work
echo "=== Recent commits ==="
git log --oneline -15
echo ""
echo "=== Status ==="
docker ps --filter "name=${PROJECT}-agent" --format "{{.Names}}: {{.Status}}" 2>/dev/null \
|| echo "(docker not available)"
rm -rf "$CHECK_DIR"