forked from puneetgavri/DevopsProjectSampleJavaApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
57 lines (56 loc) · 1.58 KB
/
Jenkinsfile
File metadata and controls
57 lines (56 loc) · 1.58 KB
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
pipeline {
agent any
stages {
stage('code clone') {
steps {
echo 'Cloning code...'
git 'https://github.com/puneetgavri/DevopsProjectSampleJavaApp.git'
}
}
stage('Compile') {
steps {
echo 'Compileing the code...'
sh '/opt/maven/bin/mvn compile'
}
}
stage('SCA') {
steps {
echo 'SCA...'
sh '/opt/maven/bin/mvn -P metrics pmd:pmd'
}
post {
success {
recordIssues enabledForFailure: true, tool: pmdParser(pattern: '**/target/pmd.xml')
}
}
}
stage('test') {
steps {
echo 'unit testing...'
sh '/opt/maven/bin/mvn test'
}
post {
success {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('codecoverage') {
steps {
echo 'unittest..'
sh script: '/opt/maven/bin/mvn verify'
}
post {
success {
jacoco buildOverBuild: true, deltaBranchCoverage: '20', deltaClassCoverage: '20', deltaComplexityCoverage: '20', deltaInstructionCoverage: '20', deltaLineCoverage: '20', deltaMethodCoverage: '20'
}
}
}
stage('package') {
steps {
echo 'Creatig package...'
sh '/opt/maven/bin/mvn package'
}
}
}
}