forked from edureka-devops/jenkins-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
71 lines (65 loc) · 2.16 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
pipeline {
agent any
stages {
stage('Clone') {
steps {
echo "checking out the repo"
git 'https://github.com/edureka-devops/jenkins-demo.git'
}
}
stage('build'){
steps {
echo "building the project"
sh "cd MavenProject ; mvn clean install ; pwd"
}
}
stage('Archieve Artifacts'){
steps {
echo "archiving the artifacts"
archiveArtifacts 'MavenProject/multi3/target/*.war'
}
}
stage('Deployment') {
// Deployment
steps {
script {
echo "deployment"
sh 'cp MavenProject/multi3/target/*.war /var/lib/tomcat8/webapps/'
}
}
}
stage('publish html report') {
steps{
echo "publishing the html report"
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: ''])
}
}
stage('clean up') {
steps {
echo "cleaning up the workspace"
cleanWs()
}
}
stage("Metrics"){
steps{
parallel ( "JavaNcss Report":
{
git 'https://github.com/edureka-devops/jenkins-demo.git'
sh "cd javancss-master ; mvn test javancss:report ; pwd"
},
"FindBugs Report" : {
sh "mkdir javancss1 ; cd javancss1 ;pwd"
git 'https://github.com/edureka-devops/jenkins-demo.git'
sh "cd javancss-master ; mvn findbugs:findbugs ; pwd"
deleteDir()
}
)
}
post{
success {
emailext body: 'Successfully completed pipeline project with archiving the artifacts', subject: 'Pipeline was successfull', to: '[email protected]'
}
}
}
}
}