Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pipeline {
- agent any
- tools {
- jdk 'JDK_8.0'
- }
- stages {
- stage('Checkout') {
- steps {
- git url: REPO_GIT , branch: DEFAULT_GIT_BRANCH, credentialsId: 'ccjava-git'
- }
- }
- stage('SonarQube Analysis') {
- steps {
- configFileProvider([configFile(fileId: 'add-build-vars.sh', variable: 'ADD_BUILD_VARS')]) {
- sh '''
- export GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
- export GIT_URL=`git config remote.origin.url`
- source $ADD_BUILD_VARS
- '''
- }
- script {
- def props = readProperties file: 'jenkins-build-vars.properties'
- echo "jenkins-build-vars.properties=${props}"
- // requires SonarQube Scanner 2.8+
- def scannerHome = tool 'sonarqube-scanner';
- withSonarQubeEnv('sonarqube') {
- sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectVersion='not provided' -Dsonar.sources=. -Dsonar.projectName='${props['SONARQUBE_PROJECTKEY']}' -Dsonar.projectKey='${props['SONARQUBE_PROJECTKEY']}' -Dsonar.branch='${props['SONARQUBE_BRANCH']}'"
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment