-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
28 lines (28 loc) · 937 Bytes
/
Jenkinsfile
File metadata and controls
28 lines (28 loc) · 937 Bytes
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
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git "${GIT_URL}"
}
}
stage('Analyze') {
agent {
docker {
image 'sonarsource/sonar-scanner-cli'
// In order to be able to use http://sonarqube:9000 we need to be in the same network as Jenkins and SonarQube are in.
args '--net jenkins_default'
// To quarantee that the workspace contains the sources pulled in previous stage, we need to use the pipeline level workspace.
reuseNode true
}
}
steps {
// The parameter must match the name you gave for the SonarQube server when configuring it.
withSonarQubeEnv('Sonar') {
// Here, job name is used as the project key and current workspace as the sources location.
sh "sonar-scanner -D'sonar.projectKey=${JOB_NAME}' -D'sonar.sources=${WORKSPACE}'"
}
}
}
}
}