-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
executable file
·82 lines (72 loc) · 2.92 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
// Tell Jenkins how to build projects from this repository
pipeline {
parameters {
// DISTRIBUTION
booleanParam(defaultValue: true, description: 'Set to true if you want to deploy to snapshot repository', name: 'DEPLOY_SNAPSHOT')
booleanParam(defaultValue: false, description: 'Set to true if you want to create a release', name: 'RELEASE')
choice(choices: 'MILESTONE\nRC\nRELEASE', description: 'Type of distribution build (only applies if release is enabled).', name: 'DISTRIBUTION_TYPE')
string(defaultValue: '0', description: 'Milestone/RC number/suffix.', name: 'DISTRIBUTION_SUFFIX')
}
agent {
label 'matlab'
}
options {
// Keep only the last 15 builds
buildDiscarder(logRotator(numToKeepStr: '15'))
// Do not execute the same pipeline concurrently
disableConcurrentBuilds()
}
tools {
jdk 'Oracle JDK 8'
}
stages {
stage('Build Massif Wrapper') {
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USER')]) {
sh '''
./gradlew clean build
'''
}
}
}
stage('Deploy to Local Repo') {
when {
branch "master"
expression { params.DEPLOY_SNAPSHOT == false}
}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USER')]) {
sh "./gradlew publish"
}
}
}
stage('Deploy to Nexus') {
when {
branch "master"
expression { params.DEPLOY_SNAPSHOT == true }
}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USER')]) {
sh "./gradlew publish -PdeployUrl='https://build.incquerylabs.com/nexus/repository/massif-wrapper-snapshots/'"
}
}
}
stage('Release') {
when {
branch "master"
expression { params.RELEASE == true }
}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USER')]) {
sh "./gradlew publish -PdeployUrl='https://build.incquerylabs.com/nexus/repository/massif-wrapper-releases/'"
}
}
}
}
post {
always {
archiveArtifacts 'rest-server/build/libs/massif-wrapper-rest-server-runnable.jar'
archiveArtifacts 'massif_scripts/massif_functions.m'
}
}
}