Merge "Allow ZTE POD2 to Publish Testing Logs"
[releng.git] / jjb / ci_gate_security / anteater-security-audit.sh
1 #!/bin/bash
2 cd $WORKSPACE
3 REPORTDIR='.reports'
4 mkdir -p $REPORTDIR
5 echo "Generating patchset file to list changed files"
6 git diff HEAD^1 --name-only | sed "s#^#/home/opnfv/anteater/$PROJECT/#" > $WORKSPACE/patchset
7 echo "Changed files are"
8 echo "--------------------------------------------------------"
9 cat $WORKSPACE/patchset
10 echo "--------------------------------------------------------"
11
12 vols="-v $WORKSPACE:/home/opnfv/anteater/$PROJECT -v $WORKSPACE/$REPORTDIR:/home/opnfv/anteater/$REPORTDIR"
13 envs="-e PROJECT=$PROJECT"
14
15 echo "Pulling releng-anteater docker image"
16 echo "--------------------------------------------------------"
17 docker pull opnfv/releng-anteater
18 echo "--------------------------------------------------------"
19
20 cmd="docker run -i $envs $vols --rm opnfv/releng-anteater \
21 /home/opnfv/venv/bin/anteater --project $PROJECT --patchset /home/opnfv/anteater/$PROJECT/patchset"
22 echo "Running docker container"
23 echo "$cmd"
24 $cmd > $WORKSPACE/securityaudit.log 2>&1
25 exit_code=$?
26 echo "--------------------------------------------------------"
27 echo "Docker container exited with code: $exit_code"
28 echo "--------------------------------------------------------"
29 cat securityaudit.log
30 exit 0