This repository has been archived by the owner on Feb 15, 2023. It is now read-only.
forked from veracode/veracode-uploadandscan-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·52 lines (41 loc) · 1.73 KB
/
entrypoint.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash -l
set -e
appname=$1
createprofile=$2
filepath=$3
version=$4
vid=$5
vkey=$6
sandboxname=$7
srcclr=$8
export SRCCLR_API_TOKEN=$9
echo "appname: $appname"
echo "sandboxname: $sandboxname"
echo "createprofile: $createprofile"
echo "filepath: $filepath"
echo "version: $version"
#below pulls latest wrapper version. alternative is to pin a version like so:
#javawrapperversion=20.8.7.1
javawrapperversion=$(curl https://repo1.maven.org/maven2/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/maven-metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1)
echo "javawrapperversion: $javawrapperversion"
# Building jar execution command
veracodejavaapicmd='/usr/local/openjdk-8/bin/java -jar VeracodeJavaAPI.jar -action UploadAndScan -autoscan true'
# if $var is set: add flag & value
[ ! -z "$appname" ] && veracodejavaapicmd+=' -appname "$appname"'
[ ! -z "$createprofile" ] && veracodejavaapicmd+=' -createprofile "$createprofile"'
[ ! -z "$filepath" ] && veracodejavaapicmd+=' -filepath "$filepath"'
[ ! -z "$version" ] && veracodejavaapicmd+=' -version "$version"'
[ ! -z "$vid" ] && veracodejavaapicmd+=' -vid "$vid"'
[ ! -z "$vkey" ] && veracodejavaapicmd+=' -vkey "$vkey"'
[ ! -z "$sandboxname" ] && veracodejavaapicmd+=' -sandboxname "$sandboxname"'
curl -sS -o VeracodeJavaAPI.jar "https://repo1.maven.org/maven2/com/veracode/vosp/api/wrappers/vosp-api-wrappers-java/$javawrapperversion/vosp-api-wrappers-java-$javawrapperversion.jar"
# Execute the command
eval $veracodejavaapicmd
if $srcclr
then
apt-get update -y
apt-get install -y python3 python3-pip
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
pip install --upgrade pip
curl -sSL https://download.sourceclear.com/ci.sh | sh -s scan
fi