-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
92 lines (76 loc) · 2.88 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env groovy
@Library("mp-jenkins-pipeline-shared") _
pipeline {
agent { label("ignite || hodor") }
parameters {
booleanParam(name: "do_release", defaultValue: false, description: "Do you want to release the application?")
string(name: "release_version", defaultValue: "", description: "Which version number should be used?")
}
options {
buildDiscarder(logRotator(numToKeepStr: "15"))
timeout(time: 60, unit: "MINUTES")
timestamps()
}
tools {
jdk "OpenJDK-21.0.6+7"
}
environment {
MAVEN_OPTS = "-Xmx1g"
}
stages {
stage("Info") {
steps {
sh "java -version"
sh "./mvnw -version"
echo "MAVEN_OPTS: ${env.MAVEN_OPTS}"
echo "Node Name: ${env.NODE_NAME}"
echo "Executor Number: ${env.EXECUTOR_NUMBER}"
echo "Source Branch (env.BRANCH_NAME): ${env.BRANCH_NAME}"
echo "PR Source Branch (env.CHANGE_BRANCH): ${env.CHANGE_BRANCH}"
echo "PR ID (env.CHANGE_ID): ${env.CHANGE_ID}"
echo "PR Target (env.CHANGE_TARGET): ${env.CHANGE_TARGET}"
echo "Release: ${params.do_release} with version: ${params.release_version}"
sendReleaseDeployNotifications(params.do_release, "STARTED", "#mp-builds", "", env.BRANCH_NAME, params.do_release, params.release_version)
}
}
stage("Set Build Name") {
steps {
script {
if (env.CHANGE_ID) {
currentBuild.displayName = "#${env.BUILD_NUMBER} - ${env.CHANGE_BRANCH}"
} else {
currentBuild.displayName = "#${env.BUILD_NUMBER} - ${env.BRANCH_NAME}"
}
}
}
}
stage("Build") {
steps {
script {
if (params.do_release) {
sh "./mvnw clean deploy scm:tag -Drevision=${params.release_version}"
} else {
sh "./mvnw clean verify"
}
}
archiveArtifacts artifacts: "**/target/*.jar", fingerprint: true
}
post {
always {
junit testResults: "**/target/surefire-reports/TEST-*.xml", allowEmptyResults: true
}
}
}
}
post {
always {
sendReleaseDeployNotifications(params.do_release, currentBuild.result, "#mp-builds", "", env.BRANCH_NAME, params.do_release, params.release_version)
}
unstable {
sendNotifications(!(params.do_release), currentBuild.result, "#mp-builds")
}
failure {
sendNotifications(!(params.do_release), currentBuild.result, "#mp-builds")
}
}
}