-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
53 lines (47 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
pipeline {
agent any
options {
// This is required if you want to clean before build with the "Workspace Cleanup Plugin"
skipDefaultCheckout(true)
}
environment {
SONARQUBE_URL = '<SonarQube URL>' // Replace with your SonarQube server URL
}
stages {
stage('SCM') {
steps {
// Clean before build using the "Workspace Cleanup Plugin"
cleanWs()
checkout scm
}
}
stage('Download Build Wrapper') {
steps {
sh '''
mkdir -p .sonar
curl -sSLo .sonar/build-wrapper-linux-x86.zip ${SONARQUBE_URL}/static/cpp/build-wrapper-linux-x86.zip
unzip -o .sonar/build-wrapper-linux-x86.zip -d .sonar/
'''
}
}
stage('Build') {
steps {
sh '''
autoreconf --install
./configure
.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make clean all
'''
}
}
stage('SonarQube Analysis') {
steps {
script {
def scannerHome = tool 'SonarScanner'; // Name of the SonarQube Scanner you created in "Global Tool Configuration" section
withSonarQubeEnv() {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
}
}
}