Skip to content

Commit aa0267f

Browse files
committed
chore(jenkinsfile): update git url & add dependency vulnerability stage
1 parent 7787e6b commit aa0267f

File tree

1 file changed

+61
-36
lines changed

1 file changed

+61
-36
lines changed

jenkins/jenkinsfile

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
node {
22
stage("Clone the project - GitHub") {
3-
git 'https://github.com/abhisheksr01/companies-house-microservice-template.git'
3+
git 'https://github.com/abhisheksr01/spring-boot-microservice-best-practices.git'
44
}
55

66
stage("Static Code Analysis - Checkstyle") {
77
sh "./gradlew clean check"
88
publishHTML target: [
9-
allowMissing : false,
10-
alwaysLinkToLastBuild: false,
11-
keepAll : true,
12-
reportDir : 'build/reports/checkstyle',
13-
reportFiles : 'main.html',
14-
reportName : 'CheckStyle - Main Class Report'
9+
allowMissing : false,
10+
alwaysLinkToLastBuild: false,
11+
keepAll : true,
12+
reportDir : 'build/reports/checkstyle',
13+
reportFiles : 'main.html',
14+
reportName : 'CheckStyle - Main Class Report'
1515
]
1616
publishHTML target: [
17-
allowMissing : false,
18-
alwaysLinkToLastBuild: false,
19-
keepAll : true,
20-
reportDir : 'build/reports/checkstyle',
21-
reportFiles : 'test.html',
22-
reportName : 'CheckStyle - Test Class Report'
17+
allowMissing : false,
18+
alwaysLinkToLastBuild: false,
19+
keepAll : true,
20+
reportDir : 'build/reports/checkstyle',
21+
reportFiles : 'test.html',
22+
reportName : 'CheckStyle - Test Class Report'
2323
]
2424
}
2525

@@ -32,16 +32,15 @@ node {
3232
sh "./gradlew test -Pexcludee2e=**/true*\n"
3333

3434
publishHTML target: [
35-
allowMissing : false,
36-
alwaysLinkToLastBuild: false,
37-
keepAll : true,
38-
reportDir : 'build/reports/tests/test',
39-
reportFiles : 'index.html',
40-
reportName : 'Unit Test Report'
35+
allowMissing: false,
36+
alwaysLinkToLastBuild: false,
37+
keepAll: true,
38+
reportDir: 'build/reports/tests/test',
39+
reportFiles: 'index.html',
40+
reportName: 'Unit Test Report'
4141
]
4242
} catch (err) {
43-
step([$class: 'JUnitResultArchiver', testResults:
44-
'**/target/surefire-reports/TEST-*UnitTest.xml'])
43+
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
4544
throw err
4645
}
4746
}
@@ -51,35 +50,61 @@ node {
5150
sh "./gradlew jacocoTestCoverageVerification"
5251

5352
publishHTML target: [
54-
allowMissing : false,
55-
alwaysLinkToLastBuild: false,
56-
keepAll : true,
57-
reportDir : 'build/reports/jacocoHtml',
58-
reportFiles : 'index.html',
59-
reportName : 'Jacoco Coverage Report'
53+
allowMissing: false,
54+
alwaysLinkToLastBuild: false,
55+
keepAll: true,
56+
reportDir: 'build/reports/jacocoHtml',
57+
reportFiles: 'index.html',
58+
reportName: 'Jacoco Coverage Report'
6059
]
6160
}
6261

6362
stage("BDD - Cucumber") {
6463
sh "./gradlew test --tests com.uk.companieshouse.e2e"
6564

6665
publishHTML target: [
67-
allowMissing : false,
68-
alwaysLinkToLastBuild: false,
69-
keepAll : true,
70-
reportDir : 'build/reports/cucumber',
71-
reportFiles : 'index.html',
72-
reportName : 'Cucumber BDD Report'
66+
allowMissing: false,
67+
alwaysLinkToLastBuild: false,
68+
keepAll: true,
69+
reportDir: 'build/reports/cucumber',
70+
reportFiles: 'cucumber-report.html',
71+
reportName: 'Cucumber BDD Report'
7372
]
7473
}
7574

7675
stage("Mutation Testing - Pitest") {
7776
try {
7877
sh "./gradlew pitest"
78+
79+
publishHTML target: [
80+
allowMissing: false,
81+
alwaysLinkToLastBuild: false,
82+
keepAll: true,
83+
reportDir: 'build/reports/cucumber',
84+
reportFiles: 'index.html',
85+
reportName: 'Mutation Testing Report'
86+
]
87+
} catch (err) {
88+
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
89+
throw err
90+
}
91+
}
92+
93+
stage("Dependency Vulnerability Check") {
94+
try {
95+
sh "./gradlew dependencyCheckAnalyze"
96+
97+
publishHTML target: [
98+
allowMissing: false,
99+
alwaysLinkToLastBuild: false,
100+
keepAll: true,
101+
reportDir: 'build/reports/dependency-vulnerabilities',
102+
reportFiles: 'dependency-check-report.html',
103+
reportName: 'Dependency Vulnerability Check Report'
104+
]
79105
} catch (err) {
80-
step([$class: 'JUnitResultArchiver', testResults:
81-
'**/target/surefire-reports/TEST-*UnitTest.xml'])
106+
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
82107
throw err
83108
}
84109
}
85-
}
110+
}

0 commit comments

Comments
 (0)