Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2 #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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/Project1/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])
}
}