-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCI.Jenkinsfile
More file actions
60 lines (59 loc) · 3.53 KB
/
CI.Jenkinsfile
File metadata and controls
60 lines (59 loc) · 3.53 KB
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
node ("docker-light") {
def sourceDir = pwd()
try {
stage("Clean up") {
step([$class: 'WsCleanup'])
}
stage("Checkout Code") {
checkout scm
}
stage("Build & Test") {
withSonarQubeEnv {
// TODO: Remove if we branch references work, otherwise, pass these to the exe somehow.
//if ("${env.CHANGE_BRANCH}" != "null") {
// mySonarOpts="$mySonarOpts -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}"
//}
//echo("Sonar Options are: $mySonarOpts")
// https://github.com/KSP-CKAN/CKAN/wiki/SSL-certificate-errors#removing-expired-lets-encrypt-certificates
// Reference for sed command and cert sync steps.
sh "docker run --rm \
--pull always \
--volume ${sourceDir}:/source \
mono:6 \
bash -c \"apt-get update && \
apt-get install unzip default-jre-headless -y && \
sed -i 's,^mozilla/DST_Root_CA_X3.crt\$,!mozilla/DST_Root_CA_X3.crt,' /etc/ca-certificates.conf && \
update-ca-certificates && \
cert-sync /etc/ssl/certs/ca-certificates.crt && \
mkdir -p /opt/sonar-scanner && \
pushd /opt/sonar-scanner && \
curl --silent --output sonar-scanner.zip --location https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.9.2.58699/sonar-scanner-msbuild-5.9.2.58699-net46.zip && \
unzip sonar-scanner.zip && \
chmod a+x /opt/sonar-scanner/sonar-scanner-*/bin/* && \
pushd /source && \
mono /opt/sonar-scanner/SonarScanner.MSBuild.exe begin /k:\"rosette-api-csharp-binding\" /d:sonar.login=\"${env.SONAR_AUTH_TOKEN}\" /d:sonar.host.url=\"${env.SONAR_HOST_URL}\" && \
nuget restore rosette_api.sln && \
msbuild /p:Configuration=Release rosette_api.sln /t:Rebuild && \
mono /opt/sonar-scanner/SonarScanner.MSBuild.exe end /d:sonar.login=\"${env.SONAR_AUTH_TOKEN}\" && \
mono ./packages/NUnit.Console.3.0.1/tools/nunit3-console.exe ./rosette_apiUnitTests/bin/Release/rosette_apiUnitTests.dll\""
// TODO: Finish coverage data gathering for Sonar.
///opt/maven-basis/bin/mvn --batch-mode clean install sonar:sonar $mySonarOpts\""
//pushd /tmp
//dotcover_version=2022.3.1
//curl --silent --location --output dotcover.tar.gz https://download.jetbrains.com/resharper/dotUltimate.2022.3.1/JetBrains.dotCover.CommandLineTools.linux-x64.2022.3.1.tar.gz
//tar xzf dotcover.tar.gz
}
}
slack(true)
} catch (e) {
currentBuild.result = "FAILED"
slack(false)
throw e
}
}
def slack(boolean success) {
def color = success ? "#00FF00" : "#FF0000"
def status = success ? "SUCCESSFUL" : "FAILED"
def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
slackSend(color: color, channel: "#p-n-c_jenkins", message: message)
}