-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
49 lines (48 loc) · 1.91 KB
/
Jenkinsfile
File metadata and controls
49 lines (48 loc) · 1.91 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
pipeline {
agent { label 'jenkins-jdk13' }
stages {
stage('Prepare') {
steps {
withCredentials(
[usernamePassword(credentialsId: 'gorefest',
usernameVariable: 'gitUser',
passwordVariable: 'gitPwd'
)]) {
script {
sh "git status"
sh "git checkout ${env.BRANCH_NAME}"
sh "git reset --hard origin/${env.BRANCH_NAME}"
pom = readMavenPom file: 'pom.xml'
final orginalVersion = pom.version
mvn("-DfailOnMissingBranchId=false -Dnamespace=io.calendarium -DbranchName=${env.BRANCH_NAME} -Dgituser=${gituser} -Dgitpassword=${gitPwd} io.crowdcode:bgav-maven-plugin:1.1.0:bgav")
pom = readMavenPom file: 'pom.xml'
final newVersion = pom.version
if (!orginalVersion.equals(newVersion)) {
sh "mkdir -p target && touch target/DO_NOT_BUILD"
env.DO_NOT_BUILD=true
} else {
env.DO_NOT_BUILD=false
}
}
}
}
}
stage('Build jar') {
when { environment name: "DO_NOT_BUILD", value: "false" }
steps { mvn("clean install") }
}
stage('Deploy jar') {
when { environment name: "DO_NOT_BUILD", value: "false" }
steps { mvn("deploy -DskipTests=true") }
}
}
}
def mvn(param) {
withMaven(
// globalMavenSettingsConfig: 'GlobalSettingsNexus',
options: [openTasksPublisher(disabled: true)],
mavenOpts: '-Xmx1536m -Xms512m',
maven: 'maven-3.6.3') {
sh "mvn -U -B -e -P linux ${param}"
}
}