Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pipeline {
- agent {
- docker {
- label 'linux'
- image 'maven:3.6.0-jdk-8-alpine'
- args containerSettings()
- reuseNode true
- }
- }
- options {
- timestamps()
- buildDiscarder(logRotator(numToKeepStr: '5'))
- timeout(time: 1, unit: 'HOURS')
- }
- stages {
- stage('Build and Test') {
- steps {
- withMaven {
- sh 'mvn clean install'
- junit '**/surefire-reports/*.xml'
- }
- }
- }
- stage('Publish Artifacts') {
- when {
- anyOf {
- branch 'master'
- branch 'develop'
- }
- }
- steps {
- withMaven {
- sh 'mvn deploy -DskipTests'
- }
- }
- }
- stage('Continuous SonarQube Analysis') {
- when {
- anyOf {
- branch 'master'
- branch 'develop'
- }
- }
- steps {
- withSonarQubeEnv('sonar-url') {
- withMaven {
- sh "mvn org.owasp:dependency-check-maven:aggregate sonar:sonar ${persistedSonarAnalysisOptions()}"
- }
- }
- }
- }
- stage('SonarQube-Reviewer') {
- when {
- anyOf {
- changeRequest()
- }
- }
- steps {
- withSonarQubeEnv('sonar-url') {
- withCredentials(sonarReviewer()) {
- withMaven {
- sh "mvn sonar:sonar ${passthroughSonarAnalysisOptions()}"
- }
- }
- }
- }
- }
- }
- post {
- changed {
- email isMainlineBranch() ? leadDeveloper() : nobody()
- }
- regression {
- email isChangeRequest() ? committers() : nobody()
- }
- success {
- email isChangeRequest() ? committers() : nobody()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement