Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pipeline {
- agent any
- triggers {
- cron('@midnight')
- }
- tools {
- maven 'M339'
- jdk 'JDK_8.0'
- }
- stages {
- stage('Checkout') {
- steps {
- checkout scm
- }
- }
- stage('Build') {
- steps {
- sh '''
- mvn $SONAR_DEFAULT_MVN_GOAL
- '''
- }
- }
- stage('SonarQube Analysis') {
- steps {
- configFileProvider([configFile(fileId: 'add-build-vars.sh', variable: 'ADD_BUILD_VARS')]) {
- sh '''
- PATH=$PATH:$HOME/bin
- 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}"
- withSonarQubeEnv('sonarqube') {
- sh "mvn $SONAR_SCANNER_MVN_GOAL -Dsonar.projectName=${props['SONARQUBE_PROJECTKEY']} -Dsonar.projectKey=${props['SONARQUBE_PROJECTKEY']} -Dsonar.branch=${env.BRANCH_NAME}"
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment