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