From d2a4db2e775638b8cbd2294585277b0a9b8b6fa4 Mon Sep 17 00:00:00 2001 From: koti143 Date: Fri, 3 Nov 2017 08:47:00 +0530 Subject: [PATCH 1/2] add sonr --- sonar-project.properties | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..37db247 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,15 @@ +# Root project information + +sonar.projectKey=org.bt +sonar.projectName=maven-web-job-dev +sonar.projectVersion=1.0 + + +# Some properties that will be inherited by the modules + +sonar.sources=src + + +# List of the module identifiers + +#sonar.modules=module1,module2 From 54e58e1eff2fb7e9f68138a06ffce21b2fc0f55a Mon Sep 17 00:00:00 2001 From: ravidops <34853137+ravidops@users.noreply.github.com> Date: Fri, 5 Aug 2022 09:50:20 -0700 Subject: [PATCH 2/2] Create Jenkinsfile --- Jenkinsfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..aa1e14c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,53 @@ +#!groovy + +node { + currentBuild.result = "SUCCESS" + + try { + + stage('envset'){ + withEnv([ + "devopsName='Jenkins DevOps'", + 'emailTo=devopstrainingblr@gmail.com', + 'emailFrom=devopstrainingblr@gmail.com' + ]) + } + stage('Checkout'){ + + checkout scm + } + + stage('Compiling'){ + + sh 'mvn deploy' + } + + stage('Sonar') { + //add stage sonar + sh 'mvn sonar:sonar' + } + stage('mail'){ + + def subject = "${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" + def summary = "${subject} (<${env.BUILD_URL}|Open>)" + def details = """

${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':

+

Error: ${errorMessage}

+

Check console output at "${env.JOB_NAME} [${env.BUILD_NUMBER}]"

""" + emailext recipientProviders: [[$class: 'DevelopersRecipientProvider']], subject: subject, body: details + } + + } + catch (err) { + + currentBuild.result = "FAILURE" + + def subject = "${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" + def summary = "${subject} (<${env.BUILD_URL}|Open>)" + def details = """

${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':

+

Error: ${errorMessage}

+

Check console output at "${env.JOB_NAME} [${env.BUILD_NUMBER}]"

""" + emailext recipientProviders: [[$class: 'DevelopersRecipientProvider']], subject: subject, body: details + + throw err + } +}