-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload_scan.sh
executable file
·52 lines (45 loc) · 1.28 KB
/
upload_scan.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
48
49
50
#!/bin/bash
set -e
project=$1
case $project in
asterixdb-hyracks)
project_name="Apache AsterixDB Hyracks"
;;
asterixdb)
project_name="Apache AsterixDB"
;;
*)
echo Unknown project: ${project}; exit 1;;
esac
project_key="$(echo $project_name | tr ' ' '+')"
archive_name="$(echo $project_name | tr ' ' '+' | tr '[A-Z]' '[a-z]').tgz"
dir="$(cd $(dirname $0) && pwd)"
work="${dir}/work/${project}"
devroot=$(cd ${dir}/../${project} && pwd)
token=$(cat ${dir}/${project}.token)
if [ -z "$token" ]; then
echo "ERROR: cannot find token for ${project}" && exit 1
fi
rm -rf ${work}
mkdir -p ${work}/cov-int
cd ${devroot}
git pull
version=$(cd $devroot && git log | head -1 | awk '{ print $NF }')
if [ "$version" = "$(cat $dir/${project}.last_version)" ]; then
echo "No new version, bypassing..."
exit 0
fi
set -x
mvn clean
mvn dependency:go-offline
cov-build --dir ${work}/cov-int mvn -o -DskipTests=true install
cd ${work}
tar czvf ${archive_name} cov-int
curl -o curl.out \
--form token=$token \
--form [email protected] \
--form file=@${archive_name} \
--form version="$version" \
--form description="${project_name} (Incubating) scan ($(date -u))" \
https://scan.coverity.com/builds?project=${project_key}
echo $version > $dir/${project}.last_version