File: source_scan_protex.sh

package info (click to toggle)
embree 3.13.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 27,924 kB
  • sloc: cpp: 180,815; xml: 3,877; ansic: 2,957; python: 1,466; sh: 502; makefile: 229; csh: 42
file content (34 lines) | stat: -rwxr-xr-x 901 bytes parent folder | download
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
#!/bin/bash

## Copyright 2009-2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

# enable early exit on fail
set -e

BDSTOOL=$PROTEX_PATH/bin/bdstool
PROTEX_PROJECT_NAME=$PROTEX_PROJECT_NAME
SERVER_URL=$PROTEX_SERVER_URL
SRC_PATH=$CI_PROJECT_DIR
LOG_FILE=/tmp/ip_protex.log

export _JAVA_OPTIONS=-Duser.home=$PROTEX_PATH/home

# enter source code directory before scanning
cd $SRC_PATH

$BDSTOOL new-project --server $SERVER_URL $PROTEX_PROJECT_NAME |& tee $LOG_FILE
$BDSTOOL analyze --server $SERVER_URL --path $SRC_PATH |& tee -a $LOG_FILE

if ! grep -E "^Files scanned successfully with no discoveries: [0-9]+$" $LOG_FILE; then
    echo "Protex scan FAILED!"
    exit 1
fi

if grep -E "^Files pending identification: [0-9]+$" $LOG_FILE; then
    echo "Protex scan FAILED! Some pending identification found. Please check on $SERVER_URL"
    exit 1
fi

echo "Protex scan PASSED!"
exit 0