-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile-upstream
More file actions
68 lines (62 loc) · 1.99 KB
/
Jenkinsfile-upstream
File metadata and controls
68 lines (62 loc) · 1.99 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
58
59
60
61
62
63
64
65
66
67
68
pipeline {
agent {
docker {image 'maven:3.8.1-adoptopenjdk-11'}
}
options {
copyArtifactPermission('devops-exercise-downstream-job');
}
stages {
stage('Checkout'){
steps{
checkout(
[
$class: 'GitSCM',
branches: [[name: '*/master']],
extensions: [],
userRemoteConfigs:
[
[
url: 'https://github.com/kashyap92/devops-exercise.git'
]
]
]
)
}
}
stage('Build') {
steps{
sh 'mvn clean compile'
}
}
stage('Test'){
steps{
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'mvn test'
}
}
}
stage('Check Vulnerabilities'){
steps{
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'mvn dependency-check:check'
dependencyCheckPublisher pattern: 'target/dependency-check-report.xml'
}
}
}
stage('Package'){
steps{
sh 'mvn -Dmaven.test.failure.ignore=true clean package'
}
}
}
post {
always {
junit '**/target/surefire-reports/TEST-*.xml'
archiveArtifacts artifacts: '**/*.jar, **/target/surefire-reports/TEST-*.xml', fingerprint: true
build job: 'devops-exercise-downstream-job',
parameters: [
[$class: 'StringParameterValue', name: 'build_number', value: "${BUILD_NUMBER}"],
[$class: 'StringParameterValue', name: 'job_name', value: "${JOB_NAME}"]]
}
}
}