diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..4705474f2 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,32 @@ +pipeline { + agent { + label 'zuvmljenson02' + } + environment { + BUILD_IMAGE = "registry.lksnext.com/devsecops/maven-java-17:2.0" + SONAR_TOKEN = credentials('sonar-analysis-token') + } + stages { + stage('Sonar') { + when { + environment name: 'JOB_ACTION', value: 'sonar' + } + steps { + script { + sh ''' + docker run --rm \ + -v ./:/app \ + -v "/home/jenkins/.m2":"/home/jenkins/.m2" \ + -e MAVEN_CMD="clean verify sonar:sonar -Dsonar.host.url=$SONAR_LKS_HOST_URL -Dsonar.token=$SONAR_TOKEN" \ + $BUILD_IMAGE + ''' + } + } + } + } + post { + always { + deleteDir() + } + } +} diff --git a/pom.xml b/pom.xml index 27fb9a6bd..e21de3090 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,8 @@ 3.6.0 0.0.11 0.0.43 - + + spring-petclinic @@ -287,6 +288,12 @@ cyclonedx-maven-plugin + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.9.1.2184 + +