-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
42 lines (32 loc) · 1.05 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
buildBranch=env.BRANCH_NAME
node () {
properties([[$class: 'jenkins.model.BuildDiscarderProperty',
strategy: [$class: 'LogRotator',
numToKeepStr: '10',
artifactNumToKeepStr: '10']]])
stage 'Checking out Project'
checkout scm
stage 'Building'
mvn( '-U clean package -fn')
if ( buildBranch.endsWith('-develop')) {
stage 'Deploying Artifacts'
mvn ('-U -DskipTests deploy')
}
stage 'Archiving Artifacts'
archive includes:'**/target/*.jar'
step $class: 'JUnitResultArchiver', testResults: '**/TEST-*.xml'
// Trigger the Downstream jobs
// tryToBuild('Secrata Packaging - Develop - Multibranch')
}
def mvn(args) {
sh "${tool 'Maven 3.0'}/bin/mvn ${args}"
}
def tryToBuild(job) {
try {
jobName = job + "/" + buildBranch
echo "Trying to build: '" + jobName + "'"
build job: jobName, quietPeriod: 10, wait: false
} catch (all) {
echo "Unable to launch downstream job: " + jobName
}
}