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