Skip to content

Commit b6ed4eb

Browse files
author
lerndevops
authored
Update Jenkinsfile
1 parent 9aac749 commit b6ed4eb

1 file changed

Lines changed: 45 additions & 49 deletions

File tree

Jenkinsfile

Lines changed: 45 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,51 @@
11
pipeline {
2-
agent any
3-
stages {
4-
stage('compile') {
5-
steps {
6-
git 'https://github.com/lerndevops/samplejavaapp.git'
7-
sh '/opt/apache-maven-3.6.3/bin/mvn compile'
8-
sleep 10
9-
}
10-
}
11-
12-
stage('codereview-pmd') {
13-
post {
14-
success {
15-
recordIssues enabledForFailure: true, tool: pmdParser(pattern: '**/target/pmd.xml')
2+
agent any
3+
stages {
4+
stage('compile') {
5+
steps {
6+
echo 'compiling..'
7+
git url: 'https://github.com/lerndevops/DevOpsClassCodes'
8+
sh script: '/opt/apache-maven-3.6.3/bin/mvn compile'
9+
}
1610
}
17-
18-
}
19-
steps {
20-
sh '/opt/apache-maven-3.6.3/bin/mvn -P metrics pmd:pmd'
21-
}
22-
}
23-
24-
stage('unit-test') {
25-
post {
26-
success {
27-
junit 'target/surefire-reports/*.xml'
11+
stage('codereview-pmd') {
12+
steps {
13+
echo 'codereview..'
14+
sh script: '/opt/apache-maven-3.6.3/bin/mvn -P metrics pmd:pmd'
15+
}
16+
post {
17+
success {
18+
recordIssues enabledForFailure: true, tool: pmdParser(pattern: '**/target/pmd.xml')
19+
}
20+
}
2821
}
29-
30-
}
31-
steps {
32-
sh '/opt/apache-maven-3.6.3/bin/mvn test'
33-
}
34-
}
35-
36-
stage('codecoverage') {
37-
post {
38-
success {
39-
cobertura(autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false)
22+
stage('unit-test') {
23+
steps {
24+
echo 'unittest..'
25+
sh script: '/opt/apache-maven-3.6.3/bin/mvn test'
26+
}
27+
post {
28+
success {
29+
junit 'target/surefire-reports/*.xml'
30+
}
31+
}
32+
}
33+
stage('codecoverate') {
34+
steps {
35+
echo 'codecoverage..'
36+
sh script: '/opt/apache-maven-3.6.3/bin/mvn cobertura:cobertura -Dcobertura.report.format=xml'
37+
}
38+
post {
39+
success {
40+
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
41+
}
42+
}
43+
}
44+
stage('package') {
45+
steps {
46+
echo 'package..'
47+
sh script: '/opt/apache-maven-3.6.3/bin/mvn package'
48+
}
4049
}
41-
42-
}
43-
steps {
44-
sh '/opt/apache-maven-3.6.3/bin/mvn cobertura:cobertura -Dcobertura.report.format=xml'
45-
}
46-
}
47-
48-
stage('package') {
49-
steps {
50-
sh '/opt/apache-maven-3.6.3/bin/mvn clean package'
51-
}
5250
}
53-
54-
}
5551
}

0 commit comments

Comments
 (0)