Guest User

Untitled

a guest
Jan 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. pipeline {
  2. agent any
  3. tools {
  4. jdk 'JDK_8.0'
  5. }
  6. stages {
  7. stage('Checkout') {
  8. steps {
  9. git url: REPO_GIT , branch: DEFAULT_GIT_BRANCH, credentialsId: 'ccjava-git'
  10. }
  11. }
  12.  
  13.  
  14. stage('SonarQube Analysis') {
  15. steps {
  16. configFileProvider([configFile(fileId: 'add-build-vars.sh', variable: 'ADD_BUILD_VARS')]) {
  17. sh '''
  18. export GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
  19. export GIT_URL=`git config remote.origin.url`
  20. source $ADD_BUILD_VARS
  21. '''
  22. }
  23. script {
  24. def props = readProperties file: 'jenkins-build-vars.properties'
  25. echo "jenkins-build-vars.properties=${props}"
  26.  
  27. // requires SonarQube Scanner 2.8+
  28. def scannerHome = tool 'sonarqube-scanner';
  29. withSonarQubeEnv('sonarqube') {
  30. 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']}'"
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment