-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
63 lines (57 loc) · 1.52 KB
/
Jenkinsfile
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
pipeline {
agent any
environment {
// Define the home directory for SonarScanner
MSBuildScannerHome = tool 'SonarScanner for MSBuild v5'
}
stages {
// Begin SonarQube analysis
stage('Begin SonarQube Analysis') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[CI-SKIP\\].*')
script {
withSonarQubeEnv() {
sh "dotnet ${MSBuildScannerHome}/SonarScanner.MSBuild.dll begin /k:\"panosru_Aviant\""
}
}
}
}
// Build the project
stage('Building') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[CI-SKIP\\].*')
sh 'dotnet restore Aviant.sln'
sh "dotnet build"
}
}
// Complete SonarQube analysis
stage('Complete SonarQube Analysis') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[CI-SKIP\\].*')
script {
withSonarQubeEnv() {
sh "dotnet ${MSBuildScannerHome}/SonarScanner.MSBuild.dll end"
}
}
}
}
// Check the quality gate status
stage('Quality Gate') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[CI-SKIP\\].*')
echo 'Waiting for quality gate to pass'
timeout(time: 2, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
}
post {
cleanup {
catchError(buildResult: null, stageResult: 'FAILURE', message: 'Cleanup Failure') {
echo 'Cleaning up workspace...'
cleanWs()
}
}
}
}