Skip to content

Commit abac8d7

Browse files
committed
CBD-4005: Various fixes for Server Black Duck scans
* Add CONAN to excluded Black Duck detectors for Server * Add necessary replace directives to stub go.mod files * Create fake version of generated Go file * Don't prune "data" directories that contain code * Remove query-ui/n1ql_parser/package.json Change-Id: If73261e0c755d5152ddf5e23f2cb71e7aafd2a26 Reviewed-on: http://review.couchbase.org/c/build-tools/+/149288 Reviewed-by: Ming Ho <[email protected]> Tested-by: Chris Hillery <[email protected]>
1 parent 9ada028 commit abac8d7

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

blackduck/couchbase-server/detect-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"detect.detector.search.depth": 9,
44
"detect.blackduck.signature.scanner.exclusion.name.patterns": "analytics",
55
"logging.level.com.synopsys.integration": "DEBUG",
6-
"detect.excluded.detector.types": "GRADLE,HEX,PEAR,PIP,NUGET",
6+
"detect.excluded.detector.types": "GRADLE,HEX,PEAR,PIP,NUGET,CONAN",
77
"detect.maven.included.scopes": "compile,runtime",
88
"detect.maven.included.modules": "cbas-install",
99
"detect.maven.build.command": "--batch-mode",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// These are all the necessary Go module replace directives for
2+
// Couchbase Server projects currently. We need to append these
3+
// to the corresponding "stub" go.mod files so that "go mod why"
4+
// (which is invoked by Black Duck when scanning the source)
5+
// knows where to look.
6+
7+
replace github.com/couchbase/cbauth => ../cbauth
8+
9+
replace github.com/couchbase/cbft => ../../../../../cbft
10+
11+
replace github.com/couchbase/cbftx => ../../../../../cbftx
12+
13+
replace github.com/couchbase/cbgt => ../../../../../cbgt
14+
15+
replace github.com/couchbase/eventing-ee => ../eventing-ee
16+
17+
replace github.com/couchbase/go-couchbase => ../go-couchbase
18+
19+
replace github.com/couchbase/go_json => ../go_json
20+
21+
replace github.com/couchbase/gomemcached => ../gomemcached
22+
23+
replace github.com/couchbase/indexing => ../indexing
24+
25+
replace github.com/couchbase/n1fty => ../n1fty
26+
27+
replace github.com/couchbase/plasma => ../plasma
28+
29+
replace github.com/couchbase/query => ../query
30+
31+
replace github.com/couchbase/query-ee => ../query-ee

blackduck/couchbase-server/prune_source.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
RELEASE=$1
44
VERSION=$2
55
BLD_NUM=$3
6+
TOOLS_DIR=$4
67

78
shopt -s extglob
89

@@ -29,6 +30,9 @@ fi
2930
# Server doesn't use asterix's dashboard, so prune that
3031
rm analytics/asterixdb/asterixdb/asterix-dashboard/src/node/package.json
3132

33+
# This is build-time only, not shipped
34+
rm -f query-ui/query-ui/n1ql_parser/package.json
35+
3236
# Server doesn't use any of bleve-mapping-ui's NPM components, so eliminate them
3337
rm -rf godeps/src/github.com/blevesearch/bleve-mapping-ui/bower_components
3438

@@ -51,7 +55,7 @@ find . -name analytics -prune -o -type d -name testdata -print0 | xargs -0 rm -r
5155
find . -name analytics -prune -o -type d -name gtest -print0 | xargs -0 rm -rf
5256
find . -name analytics -prune -o -type d -name testing -print0 | xargs -0 rm -rf
5357
find . -name analytics -prune -o -type d -name \*tests -print0 | xargs -0 rm -rf
54-
find . -name analytics -prune -o -type d -name data -print0 | xargs -0 rm -rf
58+
find . -name analytics -prune -o -name backup -prune -o -name indexing -prune -o -type d -name data -print0 | xargs -0 rm -rf
5559
find . -name analytics -prune -o -type d -name docs -print0 | xargs -0 rm -rf
5660
find . -name analytics -prune -o -type d -name example -print0 | xargs -0 rm -rf
5761
find . -name analytics -prune -o -type d -name examples -print0 | xargs -0 rm -rf
@@ -68,6 +72,20 @@ rm -rf godeps/src/golang.org/x/tools/cmd/heapview/client
6872
# projects' go.mod via replace directives, so we need to leave those there.
6973
find godeps -name 'couchbase*' -prune -o -name go.mod -print0 | xargs -0 rm -f
7074

75+
# If we find any go.mod files with zero "require" statements, they're probably one
76+
# of the stub go.mod files we introduced to make other Go projects happy. Black Duck
77+
# still wants to run "go mod why" on them, which means they need a full set of
78+
# replace directives.
79+
for stubmod in $(find . -name go.mod \! -execdir grep --quiet require '{}' \; -print); do
80+
cat ${TOOLS_DIR}/go-mod-replace.txt >> ${stubmod}
81+
done
82+
83+
# Need to fake the generated go file in eventing-ee
84+
if [ -d goproj/src/github.com/couchbase/eventing-ee/gen ]; then
85+
mkdir -p goproj/src/github.com/couchbase/eventing-ee/gen/nftp/client
86+
touch goproj/src/github.com/couchbase/eventing-ee/gen/nftp/client/evaluator.pb.go
87+
fi
88+
7189
# Remove all msvc, vcs* window projects
7290
WIN='example *msvc* *vcproj* *vcxproj* visual vstudio dot_net_example example csharp vc7ide'
7391
for windir in ${WIN}; do

blackduck/jenkins/detect-scan/blackduck-detect-scan.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ find . -name .repo -print0 | xargs -0 rm -rf
6363

6464
# Product-specific script for pruning unwanted sources
6565
if [ -x "${WORKSPACE}/build-tools/blackduck/${PRODUCT}/prune_source.sh" ]; then
66-
"${WORKSPACE}/build-tools/blackduck/${PRODUCT}/prune_source.sh" ${RELEASE} ${VERSION} ${BLD_NUM}
66+
"${WORKSPACE}/build-tools/blackduck/${PRODUCT}/prune_source.sh" \
67+
${RELEASE} ${VERSION} ${BLD_NUM} \
68+
"${WORKSPACE}/build-tools/blackduck/${PRODUCT}"
6769
fi
6870

6971
# Product-specific config for Synopsys Detect

0 commit comments

Comments
 (0)