forked from dowjones/reapsaw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·63 lines (58 loc) · 2.03 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
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
create_reports()
{
# ----------------------------------------------------------------
# Generate consolidated report and send results to Report Portal
# ----------------------------------------------------------------
RP=false
if [[ "${REPORT_PORTAL_URL}" && "${RP_TOKEN}" ]]; then
if [[ "${RP_PROJECT}" || "${PROJECT}" ]]; then
RP=true
else
echo "Please specify RP_PROJECT as environment variable for sending in Report Portal"
exit 0
fi
fi
generate_reports -r $RP
exit 0
}
{
if [[ "${TASKS}" ]]; then
mkdir -p /code/reports
if [[ "${TASKS}" == "snyk" ]]; then
echo "Snyk selected..."
if [[ "${SNYK_TOKEN}" ]]; then
scan
create_reports
else
echo "Please specify SNYK_TOKEN as environment variable."
fi
elif [[ "${TASKS}" == *"cx" ]] || [[ "${TASKS}" == *"cx_commit" ]] || [[ "${TASKS}" == "cx"* ]]; then
if [[ "${CX_USER}" ]] && [[ "${CX_PASSWORD}" ]] && [[ "${CX_URL}" ]]; then
if [[ "${TASKS}" == *"snyk"* ]]; then
if [[ "${SNYK_TOKEN}" ]]; then
echo "Checkmarx and Snyk tools selected..."
scan
create_reports
else
echo "Please specify SNYK_TOKEN as environment variable."
fi
else
echo "Checkmarx selected..."
scan
create_reports
fi
else
echo "Please specify next environment variables to run Checkmarx: 'CX_USER', 'CX_PASSWORD' and 'CX_URL'."
fi
else
echo "Unsupported TASKS value: ${TASKS}"
echo "Possible options: \"cx,snyk\", \"cx\",\"snyk\""
fi
else
echo "Please set TASKS environment variable"
fi
} || {
echo "Something went wrong. Please verify docker run command."
exit 0
}