forked from Secbyte/dotnet-sonarscanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·56 lines (42 loc) · 1.05 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
#!/bin/bash -l
# buildCommand = $1
# testCommand = $2
# projectKey = $3
# projectName = $4
# sonarHostname = $5
# sonarOrganisation = $6
# beginArguments = $7
# endArguments = $8
# restoreCommand = $9
set -eu
begin_cmd="/dotnet-sonarscanner begin \\
/k:\"${3//[$'\t\r\n']:?Please set the projectKey.}\" \\
/n:\"${4//[$'\t\r\n']:?Please set the projectName.}\" \\
/o:\"${6//[$'\t\r\n']:?Please set the sonarOrganisation.}\" \\
/d:sonar.login=\"${SONAR_TOKEN:?Please set the SONAR_TOKEN environment variable.}\""
end_cmd="/dotnet-sonarscanner end \\
/d:sonar.login=\"${SONAR_TOKEN:?Please set the SONAR_TOKEN environment variable.}\""
if [ -n "$5" ]
then
begin_cmd="$begin_cmd /d:sonar.host.url=\"${5//[$'\t\r\n']}\""
fi
if [ -n "$7" ]
then
begin_cmd="$begin_cmd $7"
fi
if [ -n "$8" ]
then
end_cmd="$end_cmd $8"
fi
sh -c "dotnet --info"
sh -c "$begin_cmd"
if [ -n "$9" ]
then
sh -c "${9//[$'\t\r\n']}"
fi
sh -c "${1//[$'\t\r\n']:?Please set the buildCommand.}"
if [ -n "$2" ]
then
sh -c "${2//[$'\t\r\n']}"
fi
sh -c "$end_cmd"