-
Notifications
You must be signed in to change notification settings - Fork 1
/
analyze.sh
executable file
·47 lines (40 loc) · 992 Bytes
/
analyze.sh
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
#!/bin/bash
scriptname=$(basename "$0")
sourcedb=$(pwd)/${1}
option=${@:2}
RED="\033[31m"
YELLOW="\033[33m"
GREEN="\033[32m"
RESET="\033[0m"
print_yellow() {
echo -e "${YELLOW}${1}${RESET}"
}
print_red() {
echo -e "${RED}${1}${RESET}"
}
print_green() {
echo -e "${GREEN}${1}${RESET}"
}
if [ "$#" -lt 1 ]; then
print_yellow "\nPlease provide relative path of codeql database directory"
print_yellow "\nUsage: ${scriptname} <directory containing source_db>"
print_yellow "\nExample: ${scriptname} ./results"
exit 1
fi
print_yellow "\nPull latest planetql image"
docker pull soohoio/planetql:latest
if [ $? -eq 0 ]
then
print_green "Image pull success\n"
else
print_red "Image pull failed\n"
exit 1
fi
print_yellow "\nRunning query"
docker run --rm --name planetql -v "${sourcedb}:/opt/results" soohoio/planetql:latest planetql analyze ${option}
if [ $? -eq 0 ]
then
print_green "Query run success\n"
else
print_red "Query run failed\n"
fi