-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: align kw check to requirements & add kw issues report
- Loading branch information
Showing
6 changed files
with
101 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
numpy | ||
sympy | ||
math |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
#!/bin/bash | ||
|
||
## Copyright 2009-2021 Intel Corporation | ||
#!/bin/bash -xe | ||
## Copyright 2020-2021 Intel Corporation | ||
## SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e | ||
export KW_BUILD_NUMBER=$(cat ./kw_build_number) | ||
export KW_PROJECT_NAME=embree | ||
export KW_CRITICAL_OUTPUT_PATH=./kw_critical.out | ||
KW_ISSUES_FILE=/tmp/issues | ||
KW_SERVER_API_URL=http://$KW_SERVER_IP:$KW_SERVER_PORT/review/api | ||
KW_BUILD_NAME=$(cat $CI_PROJECT_DIR/klocwork/build_name) | ||
|
||
echo "Checking for critical issues in $KW_BUILD_NUMBER ..." | ||
no_proxy=$KW_SERVER_IP curl -f --data "action=search&project=$KW_PROJECT_NAME&query=build:'$KW_BUILD_NUMBER'%20severity:Error,Critical%20status:Analyze,Fix&user=$KW_USER<oken=$KW_LTOKEN" http://$KW_SERVER_IP:$KW_SERVER_PORT/review/api -o $KW_CRITICAL_OUTPUT_PATH | ||
echo "Checking for issues in $KW_BUILD_NAME ..." | ||
curl -f --data "action=search&project=$KW_PROJECT_NAME&query=build:'$KW_BUILD_NAME'%20status:Analyze,Fix,Fix%20in%20Next%20Release,Fix%20in%20Later%20Release,Defer,Filter&user=$KW_USER<oken=$KW_LTOKEN" $KW_SERVER_API_URL -o $KW_ISSUES_FILE | ||
getCriticalCount() { | ||
cat $KW_CRITICAL_OUTPUT_PATH | wc -l | ||
cat $KW_ISSUES_FILE | wc -l | ||
} | ||
if [ -f $KW_CRITICAL_OUTPUT_PATH ]; then | ||
echo "****** ERROR ****** Critical issues found - $(getCriticalCount) in $KW_BUILD_NUMBER"; | ||
cat $KW_CRITICAL_OUTPUT_PATH | ||
if [ -f $KW_ISSUES_FILE ]; then | ||
echo "Issues found - $(getCriticalCount) in $KW_BUILD_NAME"; | ||
while IFS= read -r line; do echo $line | python -m json.tool; done < $KW_ISSUES_FILE | ||
exit 1; | ||
else | ||
echo "****** PASS ****** No critical issues were found in $KW_BUILD_NUMBER" | ||
echo "There are no issues which should be take care in $KW_BUILD_NAME" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash -xe | ||
## Copyright 2020-2021 Intel Corporation | ||
## SPDX-License-Identifier: Apache-2.0 | ||
|
||
KW_SERVER_API_URL=http://$KW_SERVER_IP:$KW_SERVER_PORT/review/api | ||
KW_BUILD_NAME=$(cat $CI_PROJECT_DIR/klocwork/build_name) | ||
KW_BUILD_LOG_FILE=$CI_PROJECT_DIR/klocwork/build.log | ||
|
||
export PATH="$SHARED_TOOLS_PATH:$PATH" | ||
|
||
[ -f $KW_BUILD_LOG_FILE ] || (echo "Build log file not found. Expected to be in: $KW_BUILD_LOG_FILE." ; exit 1;) | ||
|
||
mkdir -p $CI_PROJECT_DIR/klocwork | ||
report_file=$CI_PROJECT_DIR/klocwork/report.log | ||
echo "------------------" >> $report_file | ||
echo "Report generated at: "$(date '+%d/%m/%Y %H:%M:%S') >> $report_file | ||
echo "Project source code url: $CI_PROJECT_URL" >> $report_file | ||
echo "Project source code sha: $CI_COMMIT_SHA" >> $report_file | ||
echo "Klocwork server: http://$KW_SERVER_IP:$KW_SERVER_PORT" >> $report_file | ||
echo "------------------" >> $report_file | ||
|
||
echo -e "\n\n\n" >> $report_file | ||
|
||
# Get all issues list and put to report file | ||
column_list=".id, .code, .severity, .state, .status, .taxonomyName, .owner, .url, .file, .line" | ||
echo "------------------" >> $report_file | ||
echo "Issues list:" >> $report_file | ||
echo "------------------" >> $report_file | ||
echo $column_list | sed 's/\\t/ ,/g' | column -t -s, >> $report_file | ||
echo "------------------" >> $report_file | ||
curl -f --data "action=search&project=$KW_PROJECT_NAME&query=build:'$KW_BUILD_NAME'&user=$KW_USER<oken=$KW_LTOKEN" $KW_SERVER_API_URL | jq-linux64 "[${column_list}] | @tsv" | sed 's/\\t/|/g' | column -t -s'|' | cut -d'"' -f2 >> $report_file | ||
|
||
echo -e "\n\n\n" >> $report_file | ||
|
||
# Attach build log to report file | ||
echo "------------------" >> $report_file | ||
echo "Build & scan log:" >> $report_file | ||
echo "------------------" >> $report_file | ||
cat $KW_BUILD_LOG_FILE >> $report_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -xe | ||
## Copyright 2019-2021 Intel Corporation | ||
## SPDX-License-Identifier: Apache-2.0 | ||
|
||
project_name=$1 | ||
build_id=$2 | ||
group_name=$3 | ||
files=$4 | ||
STORAGE_DIR=$STORAGE_PATH/$project_name/$build_id/$group_name/ | ||
mkdir -p $STORAGE_DIR | ||
cp $files $STORAGE_DIR/ |