-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
49 lines (48 loc) · 1.63 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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
post {
always {
junit 'target/surefire-reports/*.xml'
jacoco(
execPattern: 'target/*.exec',
classPattern: 'target/classes',
sourcePattern: 'src/main/java',
exclusionPattern: 'src/test*,com/power222/tuimspfcauppbj/config/*,com/power222/tuimspfcauppbj/dao/*,com/power222/tuimspfcauppbj/model/*,com/power222/tuimspfcauppbj/TheUltimateInternshipManagerSoftwarePlatformForCollegeAndUniversityPlusPoweredByJavaApplication.class'
)
}
}
}
stage('Report to JIRA') {
steps {
script {
def commit = sh(returnStdout: true, script: 'git log -1 --pretty=%B | cat')
def comment = [ body: "Build [$BUILD_TAG|$BUILD_URL] status is ${currentBuild.currentResult}" ]
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')
{
jiraAddComment idOrKey: getCommit(commit), input: comment, auditLog: false
}
}
}
}
}
}
@NonCPS
def getCommit(commit) {
def matcher = (commit =~ '(EQ3+-[1-9][0-9]*)')
try {
return matcher[0][1]
}
catch (all) {
return 'NULL'
}
}