forked from protegeproject/protege
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
57 lines (42 loc) · 1.44 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
@Library('jenkins-shared-library') _
/**
* Job Parameters:
* skipDeploy - whether to deploy build artifacts in case of successful maven build or not (should be false by default)
* skipJavadoc - whether to build javadoc artifacts as part of the build or not
**/
try {
def currentVersion
def revision
def branch
def mavenPhase = params.skipDeploy ? "verify" : "deploy"
slack.notifyBuild()
node('build-jdk17-isolated') {
stage('Checkout repository') {
scmVars = checkout scm
pom = readMavenPom file: 'pom.xml'
currentVersion = pom.version
revision = sh(returnStdout: true, script: "git rev-parse --short HEAD").trim()
branch = scmVars.GIT_BRANCH.replaceAll("origin/", "")
println("Current version: " + currentVersion)
println("Revision: " + revision)
println("Branch: " + branch)
}
stage('Build') {
withMaven(jdk: 'OpenJDK_17', globalMavenSettingsConfig: custom_maven_settings, options: [artifactsPublisher(disabled: true)], publisherStrategy: 'EXPLICIT', traceability: true) {
if (params.skipJavadoc.toBoolean()) {
sh "./mvnw clean ${mavenPhase} -Dmaven.install.skip=true"
} else {
sh "./mvnw clean ${mavenPhase} -Prelease -Dmaven.install.skip=true"
}
}
}
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
currentBuild.result = "ABORTED"
throw e
} catch (e) {
currentBuild.result = "FAILURE"
throw e
} finally {
slack.notifyBuild(currentBuild.result)
}