From 9cba63d930b27ea173752eb0a544d6982c8fd6c2 Mon Sep 17 00:00:00 2001 From: edureka-devops <38784160+edureka-devops@users.noreply.github.com> Date: Tue, 23 Oct 2018 13:57:23 +0530 Subject: [PATCH 1/2] Create Jenkinsfile --- Jenkinsfile | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..4456e8b05 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,58 @@ +#!/usr/bin/env groovy + +import hudson.model.* +import hudson.EnvVars +import groovy.json.JsonSlurperClassic +import groovy.json.JsonBuilder +import groovy.json.JsonOutput +import java.net.URL + +try { + +node{ + + stage('Checkout') { + git 'https://github.com/edureka-git/DevOpsClassCodes' + + } + + stage('Build') { + dir('') { + sh 'mvn -B -V -U -e clean package' + } + } + + stage ('Email') { + emailext attachLog: true, body: 'The status of the build can be obtained from the build log attached', subject: 'The build update is ', to: 'shubham.k@edureka.co' +} + + +stage('Deployment') { + // Deployment + script { + echo "deployment" + sh 'cp /var/lib/jenkins/workspace/package_1/target/addressbook.war /var/lib/tomcat8/webapps/' + } + } + stage('publish html report') { + echo "publishing the html report" + publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '']) + } + stage('clean up') { + echo "cleaning up the workspace" + cleanWs() + } +}// node +} // try end +finally { + + + (currentBuild.result != "ABORTED") && node("master") { + // Send e-mail notifications for failed or unstable builds. + // currentBuild.result must be non-null for this step to work. + step([$class: 'Mailer', + notifyEveryUnstableBuild: true, + recipients: 'shubham.k@edureka.co', + sendToIndividuals: true]) + } +} From edbe4f7fb839e70cabacf22a22063ef506ed2d53 Mon Sep 17 00:00:00 2001 From: narendar27 <41665161+narendar27@users.noreply.github.com> Date: Wed, 25 May 2022 12:12:57 +0000 Subject: [PATCH 2/2] updated path --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4456e8b05..dc87dc090 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ stage('Deployment') { // Deployment script { echo "deployment" - sh 'cp /var/lib/jenkins/workspace/package_1/target/addressbook.war /var/lib/tomcat8/webapps/' + sh 'cp /var/lib/jenkins/workspace/Project1/target/addressbook.war /var/lib/tomcat8/webapps/' } } stage('publish html report') {