Skip to content

Instantly share code, notes, and snippets.

@pretty25
Created February 22, 2020 15:06
Show Gist options
  • Save pretty25/c0166b476b09c52d19e06991cfcb3f2f to your computer and use it in GitHub Desktop.
Save pretty25/c0166b476b09c52d19e06991cfcb3f2f to your computer and use it in GitHub Desktop.
pipeline {
agent any
stages {
stage("Code Checkout") {
steps {
git branch: 'master',
//The repository containing the sonar-project.properties
url: 'https://github.com/pretty25/jenkins-git-integration.git'
}
}
stage('Code Quality') {
steps {
script {
sh "pwd"
//This will call the sonar-scanner installed in the Jenkins, then it will used the sonar-project.properties configuration on the directory(workspace)
//sh "/opt/sonar-scanner/bin/sonar-scanner -Dproject.settings=sonar-project.properties"
docker run -e SONAR_HOST_URL=http://192.168.1.112:9000/ --user="$(id -jenkins):$(id -jenkins)" -it -v "$PWD:/usr/src" sonarsource/sonar-scanner-cli
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment