63 lines
1.7 KiB
Groovy
63 lines
1.7 KiB
Groovy
def MAVEN_IMAGE = 'maven:3.8.2-openjdk-11-slim'
|
|
|
|
pipeline {
|
|
agent any
|
|
|
|
stages {
|
|
stage('Build') {
|
|
agent {
|
|
docker {
|
|
image "${MAVEN_IMAGE}"
|
|
}
|
|
}
|
|
steps {
|
|
git 'https://forge.bayhan.ca/mali/sonarqubejava'
|
|
sh 'mvn -Dmaven.test.failure.ignore=true clean package'
|
|
}
|
|
|
|
post {
|
|
success {
|
|
junit '**/target/surefire-reports/TEST-*.xml'
|
|
archiveArtifacts 'tests/target/*.jar'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Static Code Analysis') {
|
|
// docker:start
|
|
// agent {
|
|
// docker {
|
|
// image 'sonarsource/sonar-scanner-cli'
|
|
// }
|
|
// }
|
|
// steps {
|
|
// withSonarQubeEnv('cicd') {
|
|
// echo '################# MAVEN ###################'
|
|
// sh 'sonar-scanner -Dsonar.projectKey=sonarqubejava:multimodule -Dsonar.sources=. -Dsonar.java.binaries=.'
|
|
// }
|
|
// }
|
|
// docker:end
|
|
|
|
// maven:start
|
|
agent any
|
|
environment {
|
|
SCANNER_HOME = tool 'sonar-scanner-4.7'
|
|
}
|
|
//agent {
|
|
// docker {
|
|
// image "${MAVEN_IMAGE}"
|
|
// }
|
|
//}
|
|
|
|
steps {
|
|
withSonarQubeEnv('cicd') {
|
|
echo '################# MAVEN ###################'
|
|
//sh 'mvn sonar:sonar'
|
|
sh "${SCANNER_HOME}/bin/sonar-scanner"
|
|
}
|
|
}
|
|
// maven:end
|
|
}
|
|
}
|
|
}
|