Skip to content

Commit

Permalink
Add addition Whitesource offline scan on 1.3 branch (#2032)
Browse files Browse the repository at this point in the history
* Add scan for 1.3 branch

Signed-off-by: Zelin Hao <zelinhao@amazon.com>

* Add scan for 1.3 branch

Signed-off-by: Zelin Hao <zelinhao@amazon.com>
  • Loading branch information
zelinh authored Apr 25, 2022
1 parent 3b65a0a commit b439dcb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jenkins/vulnerability-scan/whitesource-scan.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pipeline {
agent none
options {
timeout(time: 5, unit: 'HOURS')
timeout(time: 7, unit: 'HOURS')
}
triggers {
cron('H 3 * * *')
Expand Down
2 changes: 1 addition & 1 deletion tools/vulnerability-scan/wss-scan.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
baseDirPath=$(pwd)
gitBasePath=https://github.com/opensearch-project/
gitRepos=OpenSearch,OpenSearch-Dashboards,alerting,alerting-dashboards-plugin,anomaly-detection,anomaly-detection-dashboards-plugin,asynchronous-search,common-utils,cross-cluster-replication,dashboards-reports,dashboards-visualizations,data-prepper,index-management,index-management-dashboards-plugin,job-scheduler,k-NN,opensearch-java,opensearch-js,opensearch-py,opensearch-dsl-py,performance-analyzer,performance-analyzer-rca,perftop,security,security-dashboards-plugin,sql,observability,opensearch-build
gitRepos=OpenSearch,OpenSearch-Dashboards,alerting,alerting-dashboards-plugin,anomaly-detection,anomaly-detection-dashboards-plugin,asynchronous-search,common-utils,cross-cluster-replication,dashboards-reports,dashboards-visualizations,data-prepper,index-management,index-management-dashboards-plugin,job-scheduler,k-NN,opensearch-java,opensearch-js,opensearch-py,opensearch-dsl-py,performance-analyzer,performance-analyzer-rca,perftop,security,security-dashboards-plugin,sql,observability,opensearch-build,ml-commons,notifications
13 changes: 8 additions & 5 deletions tools/vulnerability-scan/wss-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ java -version; gradle -v; mvn -v; node -v; npm -v; yarn -v
if [ ! -f "wss-unified-agent.jar" ]
then
# Download the WhiteSource Agent
curl https://unified-agent.s3.amazonaws.com/wss-unified-agent-21.11.2.1.jar --output wss-unified-agent.jar
curl https://unified-agent.s3.amazonaws.com/wss-unified-agent-22.3.3.jar --output wss-unified-agent.jar
fi

# scan the config file for the user configurations
Expand All @@ -60,8 +60,8 @@ do
echo "Cloning repo "$gitBasePath$repo
if [ ${repo} == "OpenSearch" ]
then
echo "Cloning "$repo" at branch 1.x"
git clone -b 1.x "$gitBasePath$repo".git ${basepath}/${repo}
echo "Cloning "$repo" at branch 2.x"
git clone -b 2.x "$gitBasePath$repo".git ${basepath}/${repo}
# /qa/ in OpenSearch repo contains all files related to the previous version of ODFE.
# WhiteSource will attept to download them and take hours to build or timeout error.
# Remove /qa/ because it's irrelevant to OpenSearch.
Expand All @@ -73,7 +73,8 @@ do
done

echo -n > info.txt
target='OpenSearch'
target_main='OpenSearch'
target_1_3='OpenSearch_1_3'

# scan the Repos using the WhiteSource Unified Agent
for repo in $gitRepos
Expand Down Expand Up @@ -103,7 +104,9 @@ do
echo "build.gradle for $repo not exist, either dashboards repo or missing necessary files"
fi
fi
java -jar $baseDirPath/wss-unified-agent.jar -c $baseDirPath/wss-unified-agent.config -d $repo_path -apiKey $wss_apikey -product "$target" -project $repo
java -jar $baseDirPath/wss-unified-agent.jar -c $baseDirPath/wss-unified-agent.config -d $repo_path -apiKey $wss_apikey -product "$target_main" -project $repo
cd $repo_path && git checkout 1.3 && cd -
java -jar $baseDirPath/wss-unified-agent.jar -c $baseDirPath/wss-unified-agent.config -d $repo_path -apiKey $wss_apikey -product "$target_1_3" -project $repo
cd $baseDirPath && pwd
else
echo "Scanning failed for repo: "$gitBasePath$repo " Project: " $repo
Expand Down

0 comments on commit b439dcb

Please sign in to comment.