forked from concourse/concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrace
executable file
·48 lines (39 loc) · 890 Bytes
/
trace
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
#!/bin/bash
set -e -u
cd $(dirname $0)/..
container_name=""
dlv_flags=""
docker_flags="--interactive --privileged --rm --tty"
usage() {
echo "Usage: trace (web|worker) [--listen port]"
exit 1
}
while test $# -gt 0; do
case "$1" in
web)
container_name="concourse_web_1"
shift
;;
worker)
container_name="concourse_worker_1"
shift
;;
--listen)
shift
dlv_flags=" --headless=true --listen=:$1"
docker_flags+=" -p $1:$1"
shift
;;
*)
usage
;;
esac
done
if [ -z "$container_name" ]; then
usage
fi
trace_pid=$(docker exec $container_name pidof concourse)
docker build --tag dlv ./hack/dlv
docker run $docker_flags \
--pid=container:$container_name \
dlv attach $trace_pid $dlv_flags