Skip to content

Commit 7c033c1

Browse files
SNOW-160665 add wss.sh (#176)
1 parent d4cd0b4 commit 7c033c1

File tree

4 files changed

+180
-0
lines changed

4 files changed

+180
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,8 @@ ENV/
9797
generated_version.py
9898
*coverage.xml
9999
parameters.py
100+
101+
# WhiteSource Scan
102+
wss-*agent.config
103+
wss-unified-agent.jar
104+
whitesource/

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ env:
2626
- secure: buWiIuw+v2g3xBkLTqLSm1lHIfHRKsPo9c9C8K73swXsV5/puKq9xQiMlP8ZUgenWyXiU3Q2Xv3TvP43j0/mXA7CDhhXNVfTlVEOPF9zL64WuGy8LhFwmLF2bCZ/ZliFj+AEelyub1pmz94PihbG6pLsm9IUFMb4759Xg4t6qf6X4vjBYsWyX0xX8BNEJSgrzsZukndlCuGNwgl+UVhKeYs0DuB6K1hreVnUByScqQMBgSb82zG6XRzYMpOq8wHCsOQl8LZj6epe0q5j3gGZtEKyJcvZI/42aHto5b60mhHxFZj/mZFWtIiIs9Q/jzVr5jpr7sz38EqmErhZUNj63tQh4anNTJd6jI7nXC1CWsGqS1FvfgD8VqFrkcPXrjJrw12gpEpfY2KPst7epH65F+M+bKQU7QCxhMNwmq80eKvuCO75CzXDztzPwcG2M874IBo518iqQ2Uoy4VsA2uPYX5ZTHYT2q5nXcpZkJo5XxIBisyKkLKjkvMBKI+a+04WIO7xVW7Hq8J92BZwsbCbOMupUWDqGJ22VIR6C/ZVO0LNg/poMh2+I/BmL615/XSXkvae4rKTkl1uluetnJDEEsnUYEoKI5wEUavtQANOuUOIAL6698SZ2rotVlgJQCyS5GD3qJCOr0H7guGOu/+NRbhxVdlZf+yppjrm3fGRLw0=
2727
- secure: s/S2IVRdvtlfVbcUI+RC6Q0oc+6wXmyV3Bu0bDvAsMSXxbpil8YJym4YSrk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RyvzXKNMqYdhSkm2INKcI7lC726aaGcRVN2DXZs7ckIyg4H2pbOeYPq6scm8oZh9HOGeazLgSESSQHGQFPzAXnAcbk4uLDN6y86U7FcYpatINuiEtmHokMvjt/Da14PCMgTsbHhDGXoQY4Avcz5IzshUm4TDGgg+mQCbEX0Ek5TK0MLaQe0cKZbkXiIngYcyPQz5AaVCDw4VqbCSJIGzpBownZ6BmJCCEq2NJY5AlXmgV9mu0=
29+
- secure: X5LNF/HMGvKL9nArM6TlV2fuA930b5NECU95bJSsuemJEbEewPi8Fl/I8LF/y9EjEPAs2i+vV74Ywbg6rbAtLl7WEBbpKiQiUeQZcVgCVKra8m7ewh8d8v2Ss3v7kB8GR2pyHFbz2jgw6XuKXeI4aFVyFW51chxSmyEVde/4COIO8rlFXk6J2lIHHdFQ+5x88kPXVhx7DcvEXvTjDSrRVnNjLbh01uZ/GTY6W2RfWn1CI9AuaVVd8riyscEyca4u3W8idgJjvMuy7l1wZOVdnSfySex5heeguzCj/dkhuoBXhng5mzI/MBOpDUF3t69CUJM6ZSyJedHmri9FAtm6kjn2DWvydikcEPnlMyEpgSW1l6yeRfOkJC5MqsYgAaa7kmzuu8gbcjfQgH4K5ICqTSAGa0UYYGyd44op7imXzzuJoCF2jFKqV7vLitv7TYgw5Wx+/hAOrGAbtMeih+BxAqH0shA+EfMSwXcVj0qQl8VA9udRpQmrvGMeAs1e9n5xy4MkF4KosZiLrYljRE2KK0A7aTDidv7B5gzGtMJhwV0ZzZAXMUsocAMDPDk9YU+bJemgAyB0X+FmzizqHUxLQrfbjdJ0NSrLDXMjMvkUn2oL+6QedYpwP/l1QKlDgzwiyzJDuCRk/Tgyar9jvUh3MolOTmA99XUW9gbIGuUTP5o=

ci/wss.sh

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Run whitesource for components which need versioning
4+
set -e
5+
set -o pipefail
6+
7+
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
9+
[[ -z "$WHITESOURCE_API_KEY" ]] && echo "[WARNING] No WHITESOURCE_API_KEY is set. No WhiteSource scan will occur." && exit 0
10+
11+
if [[ -z "$VIRTUAL_ENV" ]]; then
12+
PY=
13+
TMP_VENV=$(mktemp -d)
14+
if which python3 >& /dev/null; then
15+
PY=python3
16+
elif which python3.7 >& /dev/null; then
17+
PY=python3.7
18+
elif which python3.6 >& /dev/null; then
19+
PY=python3.6
20+
elif which python3.5 >& /dev/null; then
21+
PY=python3.5
22+
elif which python >& /dev/null; then
23+
if [[ "$(python -c 'import sys; print(sys.version_info.major)')" == "3" ]]; then
24+
PY=python
25+
fi
26+
fi
27+
[[ -z "$PY" ]] && echo "[ERROR] Failed to find Python3" && exit 1
28+
29+
echo "[INFO] Installing Python Virtualenv"
30+
$PY -m venv $TMP_VENV >& /dev/null
31+
source $TMP_VENV/bin/activate
32+
IS_IN_CUSTOM_VENV=true
33+
else
34+
echo "[INFO] Using Python Virtualenv $VIRTUAL_ENV"
35+
fi
36+
pip install -U pip virtualenv >& /dev/null
37+
38+
export PRODUCT_NAME=SQLAlchemy
39+
export PROJECT_NAME=SQLAlchemy
40+
41+
DATE=$(date +'%m-%d-%Y')
42+
43+
SCAN_DIRECTORIES=$(cd $THIS_DIR/.. && pwd)
44+
45+
rm -f wss-unified-agent.jar
46+
curl -LO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar
47+
48+
# whitesource will scan the folder and detect the corresponding configuration
49+
# configuration file wss-generated-file.config will be generated under ${SCAN_DIRECTORIES}
50+
# java -jar wss-unified-agent.jar -detect -d ${SCAN_DIRECTORIES}
51+
# SCAN_CONFIG="${SCAN_DIRECTORIES}/wss-generated-file.config"
52+
53+
# SCAN_CONFIG is the path to your whitesource configuration file
54+
SCAN_CONFIG=wss-agent.config
55+
cat > $SCAN_CONFIG <<CONFIG
56+
###############################################################
57+
# WhiteSource Unified-Agent configuration file
58+
###############################################################
59+
# PYTHON SCAN MODE: setup.py
60+
###############################################################
61+
62+
apiKey=
63+
#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option
64+
#userKey=
65+
66+
67+
projectName=
68+
projectVersion=
69+
projectToken=
70+
#projectTag= key:value
71+
72+
productName=
73+
productVersion=
74+
productToken=
75+
76+
#projectPerFolder=true
77+
#projectPerFolderIncludes=
78+
#projectPerFolderExcludes=
79+
80+
#wss.connectionTimeoutMinutes=60
81+
wss.url=https://saas.whitesourcesoftware.com/agent
82+
83+
############
84+
# Policies #
85+
############
86+
checkPolicies=true
87+
forceCheckAllDependencies=false
88+
forceUpdate=false
89+
forceUpdate.failBuildOnPolicyViolation=false
90+
#updateInventory=false
91+
92+
###########
93+
# General #
94+
###########
95+
#offline=false
96+
#updateType=APPEND
97+
#ignoreSourceFiles=true
98+
#scanComment=
99+
#failErrorLevel=ALL
100+
#requireKnownSha1=false
101+
102+
#generateProjectDetailsJson=true
103+
#generateScanReport=true
104+
#scanReportTimeoutMinutes=10
105+
#scanReportFilenameFormat=
106+
107+
#analyzeFrameworks=true
108+
#analyzeFrameworksReference=
109+
110+
#updateEmptyProject=false
111+
112+
#log.files.level=
113+
#log.files.maxFileSize=
114+
#log.files.maxFilesCount=
115+
#log.files.path=
116+
117+
########################################
118+
# Package Manager Dependency resolvers #
119+
########################################
120+
resolveAllDependencies=false
121+
122+
python.resolveDependencies=true
123+
python.ignoreSourceFiles=false
124+
python.ignorePipInstallErrors=true
125+
python.installVirtualenv=false # set this parameter to true if using virtualenv to build the project
126+
python.resolveHierarchyTree=false
127+
python.resolveSetupPyFiles=true
128+
python.runPipenvPreStep=false
129+
#python.IgnorePipenvInstallErrors=true
130+
python.resolveGlobalPackages=false
131+
132+
###########################################################################################
133+
# Includes/Excludes Glob patterns - Please use only one exclude line and one include line #
134+
###########################################################################################
135+
includes=**/*.egg **/*.whl **/*.py
136+
137+
#Exclude file extensions or specific directories by adding **/*.<extension> or **/<excluded_dir>/**
138+
excludes=**/*sources.jar **/*javadoc.jar
139+
140+
case.sensitive.glob=false
141+
followSymbolicLinks=true
142+
CONFIG
143+
144+
echo "[INFO] Running wss.sh for ${PROJECT_NAME}-${PRODUCT_NAME} under ${SCAN_DIRECTORIES}"
145+
java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} \
146+
-c ${SCAN_CONFIG} \
147+
-project ${PROJECT_NAME} \
148+
-product ${PRODUCT_NAME} \
149+
-d ${SCAN_DIRECTORIES} \
150+
-wss.url https://saas.whitesourcesoftware.com/agent \
151+
-offline true
152+
153+
if java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} \
154+
-c ${SCAN_CONFIG} \
155+
-project ${PROJECT_NAME} \
156+
-product ${PRODUCT_NAME} \
157+
-projectVersion baseline \
158+
-requestFiles whitesource/update-request.txt \
159+
-wss.url https://saas.whitesourcesoftware.com/agent ; then
160+
echo "checkPolicies=false" >> ${SCAN_CONFIG}
161+
java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} \
162+
-c ${SCAN_CONFIG} \
163+
-project ${PROJECT_NAME} \
164+
-product ${PRODUCT_NAME} \
165+
-projectVersion ${DATE} \
166+
-requestFiles whitesource/update-request.txt \
167+
-wss.url https://saas.whitesourcesoftware.com/agent
168+
fi
169+
[[ -n "$IS_IN_CUSTOM_VENV" ]] && deactivate || true

scripts/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#
55
set -o pipefail
66

7+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
79
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
810
curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macosx10.9.pkg
911
sudo installer -pkg python-${PYTHON_VERSION}-macosx10.9.pkg -target /
@@ -23,6 +25,9 @@ else
2325
openssl aes-256-cbc -k "$super_secret_password" -in parameters.py.enc -out test/parameters.py -d
2426
fi
2527

28+
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
29+
$SCRIPTS_DIR/../ci/wss.sh
30+
fi
2631
source ./venv/bin/activate
2732
pip install '.[development]'
2833
pip list --format=columns

0 commit comments

Comments
 (0)