summaryrefslogtreecommitdiffstats
path: root/jjb/ci_gate_security/anteater-security-audit-weekly.sh
blob: 6caa131179fd30cdad643d05508188918eab2b3b (plain)
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

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.P
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

ANTEATER_SCAN_PATCHSET="${ANTEATER_SCAN_PATCHSET:-true}"

cd $WORKSPACE
REPORTDIR='.reports'
mkdir -p $REPORTDIR
# Ensure any user can read the reports directory
chmod 777 $REPORTDIR

ANTEATER_FILES="--patchset /home/opnfv/anteater/$PROJECT/patchset"

if [[ "$ANTEATER_SCAN_PATCHSET" == "true" ]]; then
    echo "Generating patchset file to list changed files"
    git diff HEAD^1 --name-only | sed "s#^#/home/opnfv/anteater/$PROJECT/#" > $WORKSPACE/patchset
    echo "Changed files are"
    echo "--------------------------------------------------------"
    cat $WORKSPACE/patchset
    echo "--------------------------------------------------------"
else
    echo "Checking full project $PROJECT"
    ANTEATER_FILES="--path /home/opnfv/anteater/$PROJECT"
fi

vols="-v $WORKSPACE:/home/opnfv/anteater/$PROJECT -v $WORKSPACE/$REPORTDIR:/home/opnfv/anteater/$REPORTDIR"
envs="-e PROJECT=$PROJECT"

echo "Pulling releng-anteater docker image"
echo "--------------------------------------------------------"
docker pull opnfv/releng-anteater
echo "--------------------------------------------------------"

cmd="docker run -i $envs $vols --rm opnfv/releng-anteater \
/home/opnfv/venv/bin/anteater --project $PROJECT $ANTEATER_FILES"
echo "Running docker container"
echo "$cmd"
$cmd > $WORKSPACE/securityaudit.log 2>&1
exit_code=$?
echo "--------------------------------------------------------"
echo "Docker container exited with code: $exit_code"
echo "--------------------------------------------------------"
exit 0