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+
13pipeline {
24 agent any
35 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+ }
416 stage(' Checkout' ) {
517 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'
720 }
821 }
922 stage(' Analyze' ) {
1023 agent {
1124 docker {
1225 image ' sonarsource/sonar-scanner-cli'
1326 // 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 "
1528 // To quarantee that the workspace contains the sources pulled in previous stage, we need to use the pipeline level workspace.
1629 reuseNode true
1730 }
You can’t perform that action at this time.
0 commit comments