File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
docs/tutorials/jenkins/sonarqube-jenkins Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change
1
+ def net = ' ' // Set the value to 'host' to use host networking.
2
+
1
3
pipeline {
2
4
agent any
3
5
stages {
6
+ stage (' Prepare' ) {
7
+ steps {
8
+ script {
9
+ if (net == ' ' ) {
10
+ // Get the name of the network that Jenkins container is using.
11
+ net = sh returnStdout : true , script : ' docker inspect $(hostname) -f \' {{ range $k, $v := .NetworkSettings.Networks }}{{ $k }}{{ end }}\' '
12
+ }
13
+ }
14
+ }
15
+ }
4
16
stage(' Checkout' ) {
5
17
steps {
6
- git " ${ GIT_URL} "
18
+ // Replace the git step below with step that pulls the repository you want to analyze.
19
+ git branch : ' main' , url : ' https://github.com/cicd-tutorials/feedback.git'
7
20
}
8
21
}
9
22
stage(' Analyze' ) {
10
23
agent {
11
24
docker {
12
25
image ' sonarsource/sonar-scanner-cli'
13
26
// In order to be able to use http://sonarqube:9000 we need to be in the same network as Jenkins and SonarQube are in.
14
- args ' --net jenkins_default '
27
+ args " --net $n et "
15
28
// To quarantee that the workspace contains the sources pulled in previous stage, we need to use the pipeline level workspace.
16
29
reuseNode true
17
30
}
You can’t perform that action at this time.
0 commit comments